From 229f724ef4a0a4cbc426f31e27f9a57e9b1307c9 Mon Sep 17 00:00:00 2001 From: nea Date: Fri, 5 May 2023 01:35:04 +0200 Subject: Fix clipping --- .../moe/nea/notenoughupdates/recipes/SBForgeRecipe.kt | 5 +++-- .../moe/nea/notenoughupdates/rei/NEUItemEntryRenderer.kt | 15 ++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/main/kotlin/moe/nea/notenoughupdates/recipes/SBForgeRecipe.kt b/src/main/kotlin/moe/nea/notenoughupdates/recipes/SBForgeRecipe.kt index 0a81214..a9301ac 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/recipes/SBForgeRecipe.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/recipes/SBForgeRecipe.kt @@ -29,15 +29,16 @@ class SBForgeRecipe(override val neuRecipe: NEUForgeRecipe) : SBRecipe() { override fun getIcon(): Renderer = EntryStacks.of(Blocks.ANVIL) override fun setupDisplay(display: SBForgeRecipe, bounds: Rectangle): List { return buildList { + // TODO: proper gui for this (possibly inspired by the old circular gui) add(Widgets.createRecipeBase(bounds)) - val resultSlot = Point(bounds.centerX - 18 / 2, bounds.centerY + 5) + val resultSlot = Point(bounds.centerX, bounds.centerY + 5) add(Widgets.createResultSlotBackground(resultSlot)) val ingredientsCenter = Point(bounds.centerX, bounds.centerY - 20) val count = display.neuRecipe.inputs.size display.neuRecipe.inputs.forEachIndexed { idx, ingredient -> add( Widgets.createSlot( - Point(ingredientsCenter.x - 18 / 2 - count / 2 * 24 + idx * 24, ingredientsCenter.y) + Point(ingredientsCenter.x + 12 - count * 24 / 2 + idx * 24, ingredientsCenter.y) ).markInput().entry(SBItemEntryDefinition.getEntry(ingredient)) ) } diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntryRenderer.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntryRenderer.kt index e794039..111aaf7 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntryRenderer.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUItemEntryRenderer.kt @@ -6,9 +6,8 @@ import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer import me.shedaniel.rei.api.client.gui.widgets.Tooltip import me.shedaniel.rei.api.client.gui.widgets.TooltipContext import me.shedaniel.rei.api.common.entry.EntryStack -import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes -import moe.nea.notenoughupdates.rei.NEUReiPlugin.Companion.asItemEntry import net.minecraft.client.util.math.MatrixStack +import moe.nea.notenoughupdates.rei.NEUReiPlugin.Companion.asItemEntry object NEUItemEntryRenderer : EntryRenderer { override fun render( @@ -19,16 +18,14 @@ object NEUItemEntryRenderer : EntryRenderer { mouseY: Int, delta: Float ) { - VanillaEntryTypes.ITEM.definition.renderer - .render( - entry.asItemEntry(), - matrices, bounds, mouseX, mouseY, delta - ) + matrices.push() + matrices.translate(0F, 0F, 100F) + entry.asItemEntry().render(matrices, bounds, mouseX, mouseY, delta) + matrices.pop() } override fun getTooltip(entry: EntryStack, tooltipContext: TooltipContext): Tooltip? { - return VanillaEntryTypes.ITEM.definition.renderer - .getTooltip(entry.asItemEntry(), tooltipContext) + return entry.asItemEntry().getTooltip(tooltipContext, false) } } -- cgit