Update client event handler
This commit is contained in:
parent
0fdc3ef97e
commit
9cc572be62
@ -17,7 +17,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue;
|
||||
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability;
|
||||
import ru.dbotthepony.mc.otm.capability.drive.DrivePool;
|
||||
import ru.dbotthepony.mc.otm.client.ClientEventHandler;
|
||||
import ru.dbotthepony.mc.otm.client.ClientEventHandlerKt;
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI;
|
||||
import ru.dbotthepony.mc.otm.client.model.GravitationStabilizerModel;
|
||||
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel;
|
||||
@ -146,9 +146,9 @@ public final class OverdriveThatMatters {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryGUI.INSTANCE::onRenderGuiEvent);
|
||||
EVENT_BUS.addListener(EventPriority.HIGH, MatteryGUI.INSTANCE::onLayerRenderEvent);
|
||||
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandler.INSTANCE::inputEvent);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandler.INSTANCE::screenOpen);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandler.INSTANCE::postScreenInit);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMovementInputUpdate);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onScreenOpen);
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onPostScreenInit);
|
||||
|
||||
if (ModList.get().isLoaded("mekanism")) {
|
||||
EVENT_BUS.addListener(EventPriority.NORMAL, TooltipsKt::tooltipEvent);
|
||||
|
@ -13,8 +13,7 @@ import ru.dbotthepony.mc.otm.client.screen.panels.Panel2Widget
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
|
||||
|
||||
object ClientEventHandler {
|
||||
fun inputEvent(event: MovementInputUpdateEvent) {
|
||||
fun onMovementInputUpdate(event: MovementInputUpdateEvent) {
|
||||
val ply = event.entity
|
||||
val input = event.input
|
||||
|
||||
@ -43,11 +42,11 @@ object ClientEventHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var shouldOpenVanillaInventory = false
|
||||
var shouldOpenVanillaInventory = false
|
||||
|
||||
fun postScreenInit(event: ScreenEvent.Init.Post) {
|
||||
fun onPostScreenInit(event: ScreenEvent.Init.Post) {
|
||||
val player = minecraft.player?.matteryPlayer ?: return
|
||||
|
||||
val screen = event.screen as? InventoryScreen ?: return
|
||||
@ -69,9 +68,9 @@ object ClientEventHandler {
|
||||
InputConstants.grabOrReleaseMouse(minecraft.window.window, 212993, mouseX, mouseY)
|
||||
}).also { it.tooltip = TranslatableComponent("otm.gui.exosuit.go_in") }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun screenOpen(event: ScreenEvent.Opening) {
|
||||
fun onScreenOpen(event: ScreenEvent.Opening) {
|
||||
if (shouldOpenVanillaInventory || minecraft.player?.isCreative == true) {
|
||||
return
|
||||
}
|
||||
@ -81,5 +80,4 @@ object ClientEventHandler {
|
||||
if (player.hasExoSuit && event.newScreen is InventoryScreen) {
|
||||
event.newScreen = ExoSuitInventoryScreen(player.exoSuitMenu)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ package ru.dbotthepony.mc.otm.client.screen
|
||||
import com.mojang.blaze3d.platform.InputConstants
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen
|
||||
import ru.dbotthepony.mc.otm.client.ClientEventHandler
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.mc.otm.client.render.element
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.*
|
||||
import ru.dbotthepony.mc.otm.client.shouldOpenVanillaInventory
|
||||
import ru.dbotthepony.mc.otm.menu.ExoSuitInventoryMenu
|
||||
import ru.dbotthepony.mc.otm.network.ExoSuitMenuOpen
|
||||
import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel
|
||||
@ -129,7 +129,7 @@ class ExoSuitInventoryScreen(menu: ExoSuitInventoryMenu) : MatteryScreen<ExoSuit
|
||||
scrollPanel.setDockMargin(right = 3f)
|
||||
|
||||
LargeSquareButtonPanel(this, frame, x = frame.width + 2f, skinElement = Widgets18.RETURN_ARROW_LEFT, onPress = {
|
||||
ClientEventHandler.shouldOpenVanillaInventory = true
|
||||
shouldOpenVanillaInventory = true
|
||||
val minecraft = minecraft!!
|
||||
|
||||
val mouseX = minecraft.mouseHandler.xpos()
|
||||
|
Loading…
Reference in New Issue
Block a user