Skip to content

Commit

Permalink
goofy
Browse files Browse the repository at this point in the history
  • Loading branch information
ttttdoy committed Aug 29, 2024
1 parent 4b587be commit 472138d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/kotlin/breadmod/client/render/SoundBlockRenderer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package breadmod.client.render

import breadmod.block.entity.SoundBlockEntity
import breadmod.util.render.drawTextOnSide
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.renderer.MultiBufferSource
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer

// todo adapt GuiGraphics scrolling text to BER
class SoundBlockRenderer: BlockEntityRenderer<SoundBlockEntity> {
override fun render(
pBlockEntity: SoundBlockEntity,
pPartialTick: Float,
pPoseStack: PoseStack,
pBuffer: MultiBufferSource,
pPackedLight: Int,
pPackedOverlay: Int
) {
// drawTextOnSide()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import breadmod.util.gui.widget.ContainerWidget
import breadmod.util.gui.widget.InventoryWidget
import breadmod.util.gui.widget.TextWidget
import breadmod.util.render.rgMinecraft
import com.mojang.blaze3d.platform.InputConstants
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
Expand All @@ -27,6 +28,15 @@ internal class SoundBlockSerializedScreen(
super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick)
}

override fun keyPressed(pKeyCode: Int, pScanCode: Int, pModifiers: Int): Boolean {
val mouseKey = InputConstants.getKey(pKeyCode, pScanCode)
return if (pKeyCode == InputConstants.KEY_ESCAPE ||
rgMinecraft.options.keyInventory.isActiveAndMatches(mouseKey) && shouldCloseOnEsc()) {
onClose()
true
} else super.keyPressed(pKeyCode, pScanCode, pModifiers)
}

override fun init() {
super.init()
val image = rootWidget.getTaggedWidget("background")
Expand Down

0 comments on commit 472138d

Please sign in to comment.