aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/customgui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/customgui')
-rw-r--r--src/main/kotlin/util/customgui/CoordRememberingSlot.kt2
-rw-r--r--src/main/kotlin/util/customgui/CustomGui.kt31
-rw-r--r--src/main/kotlin/util/customgui/HasCustomGui.kt4
3 files changed, 20 insertions, 17 deletions
diff --git a/src/main/kotlin/util/customgui/CoordRememberingSlot.kt b/src/main/kotlin/util/customgui/CoordRememberingSlot.kt
index c61c711..e565850 100644
--- a/src/main/kotlin/util/customgui/CoordRememberingSlot.kt
+++ b/src/main/kotlin/util/customgui/CoordRememberingSlot.kt
@@ -1,7 +1,7 @@
package moe.nea.firmament.util.customgui
-import net.minecraft.screen.slot.Slot
+import net.minecraft.world.inventory.Slot
interface CoordRememberingSlot {
fun rememberCoords_firmament()
diff --git a/src/main/kotlin/util/customgui/CustomGui.kt b/src/main/kotlin/util/customgui/CustomGui.kt
index 35c60ac..f64bf4d 100644
--- a/src/main/kotlin/util/customgui/CustomGui.kt
+++ b/src/main/kotlin/util/customgui/CustomGui.kt
@@ -1,8 +1,11 @@
package moe.nea.firmament.util.customgui
import me.shedaniel.math.Rectangle
-import net.minecraft.client.gui.DrawContext
-import net.minecraft.screen.slot.Slot
+import net.minecraft.client.input.MouseButtonEvent
+import net.minecraft.client.gui.GuiGraphics
+import net.minecraft.client.input.CharacterEvent
+import net.minecraft.client.input.KeyEvent
+import net.minecraft.world.inventory.Slot
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.HandledScreenPushREIEvent
@@ -23,19 +26,19 @@ abstract class CustomGui {
}
open fun render(
- drawContext: DrawContext,
- delta: Float,
- mouseX: Int,
- mouseY: Int
+ drawContext: GuiGraphics,
+ delta: Float,
+ mouseX: Int,
+ mouseY: Int
) {
}
- open fun mouseClick(mouseX: Double, mouseY: Double, button: Int): Boolean {
+ open fun mouseClick(click: MouseButtonEvent, doubled: Boolean): Boolean {
return false
}
- open fun afterSlotRender(context: DrawContext, slot: Slot) {}
- open fun beforeSlotRender(context: DrawContext, slot: Slot) {}
+ open fun afterSlotRender(context: GuiGraphics, slot: Slot) {}
+ open fun beforeSlotRender(context: GuiGraphics, slot: Slot) {}
open fun mouseScrolled(mouseX: Double, mouseY: Double, horizontalAmount: Double, verticalAmount: Double): Boolean {
return false
}
@@ -69,23 +72,23 @@ abstract class CustomGui {
return true
}
- open fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean {
+ open fun mouseReleased(click: MouseButtonEvent): Boolean {
return false
}
- open fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, deltaX: Double, deltaY: Double): Boolean {
+ open fun mouseDragged(click: MouseButtonEvent, offsetX: Double, offsetY: Double): Boolean {
return false
}
- open fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
+ open fun keyPressed(input: KeyEvent): Boolean {
return false
}
- open fun charTyped(chr: Char, modifiers: Int): Boolean {
+ open fun charTyped(input: CharacterEvent): Boolean {
return false
}
- open fun keyReleased(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
+ open fun keyReleased(input: KeyEvent): Boolean {
return false
}
}
diff --git a/src/main/kotlin/util/customgui/HasCustomGui.kt b/src/main/kotlin/util/customgui/HasCustomGui.kt
index edead2e..7182979 100644
--- a/src/main/kotlin/util/customgui/HasCustomGui.kt
+++ b/src/main/kotlin/util/customgui/HasCustomGui.kt
@@ -1,7 +1,7 @@
package moe.nea.firmament.util.customgui
-import net.minecraft.client.gui.screen.ingame.HandledScreen
+import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
@Suppress("FunctionName")
interface HasCustomGui {
@@ -9,7 +9,7 @@ interface HasCustomGui {
fun setCustomGui_Firmament(gui: CustomGui?)
}
-var <T : HandledScreen<*>> T.customGui: CustomGui?
+var <T : AbstractContainerScreen<*>> T.customGui: CustomGui?
get() = (this as HasCustomGui).getCustomGui_Firmament()
set(value) {
(this as HasCustomGui).setCustomGui_Firmament(value)