This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
screen events, more documentation, cleanup
- Loading branch information
Showing
13 changed files
with
171 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
@file:JvmName("GameTime") | ||
|
||
package io.github.homchom.recode.game | ||
|
||
import io.github.homchom.recode.Power | ||
|
6 changes: 6 additions & 0 deletions
6
src/main/java/io/github/homchom/recode/hypercube/BukkitFunctions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.github.homchom.recode.hypercube | ||
|
||
import io.github.homchom.recode.game.getCompoundOrNull | ||
import net.minecraft.nbt.CompoundTag | ||
|
||
val CompoundTag.publicBukkitValues get() = getCompoundOrNull("PublicBukkitValues") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/io/github/homchom/recode/render/ScreenEvents.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@file:JvmName("ScreenEvents") | ||
|
||
package io.github.homchom.recode.render | ||
|
||
import io.github.homchom.recode.event.wrapFabricEvent | ||
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents.* | ||
import net.minecraft.client.Minecraft | ||
import net.minecraft.client.gui.GuiGraphics | ||
import net.minecraft.client.gui.screens.Screen | ||
|
||
val BeforeInitScreenEvent = wrapFabricEvent(BEFORE_INIT) { listener -> | ||
BeforeInit { client, screen, scaledWidth, scaledHeight -> | ||
listener(ScreenInitContext(client, screen, scaledWidth, scaledHeight)) | ||
} | ||
} | ||
|
||
val AfterInitScreenEvent = wrapFabricEvent(AFTER_INIT) { listener -> | ||
AfterInit { client, screen, scaledWidth, scaledHeight -> | ||
listener(ScreenInitContext(client, screen, scaledWidth, scaledHeight)) | ||
} | ||
} | ||
|
||
data class ScreenInitContext( | ||
val client: Minecraft, | ||
val screen: Screen, | ||
val scaledWidth: Int, | ||
val scaledHeight: Int | ||
) | ||
|
||
fun Screen.afterRender() = wrapFabricEvent(afterRender(this)) { listener -> | ||
AfterRender { screen, drawContext, mouseX, mouseY, tickDelta -> | ||
listener(ScreenRenderContext(screen, drawContext, mouseX, mouseY, tickDelta)) | ||
} | ||
} | ||
|
||
data class ScreenRenderContext( | ||
val screen: Screen, | ||
val guiGraphics: GuiGraphics, | ||
val mouseX: Int, | ||
val mouseY: Int, | ||
val tickDelta: Float | ||
) | ||
|
||
fun Screen.onRemove() = wrapFabricEvent(remove(this), ::Remove) |
8 changes: 0 additions & 8 deletions
8
src/main/java/io/github/homchom/recode/util/TraitInterfaces.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.