Fix clipping
This commit is contained in:
@@ -29,15 +29,16 @@ class SBForgeRecipe(override val neuRecipe: NEUForgeRecipe) : SBRecipe() {
|
|||||||
override fun getIcon(): Renderer = EntryStacks.of(Blocks.ANVIL)
|
override fun getIcon(): Renderer = EntryStacks.of(Blocks.ANVIL)
|
||||||
override fun setupDisplay(display: SBForgeRecipe, bounds: Rectangle): List<Widget> {
|
override fun setupDisplay(display: SBForgeRecipe, bounds: Rectangle): List<Widget> {
|
||||||
return buildList {
|
return buildList {
|
||||||
|
// TODO: proper gui for this (possibly inspired by the old circular gui)
|
||||||
add(Widgets.createRecipeBase(bounds))
|
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))
|
add(Widgets.createResultSlotBackground(resultSlot))
|
||||||
val ingredientsCenter = Point(bounds.centerX, bounds.centerY - 20)
|
val ingredientsCenter = Point(bounds.centerX, bounds.centerY - 20)
|
||||||
val count = display.neuRecipe.inputs.size
|
val count = display.neuRecipe.inputs.size
|
||||||
display.neuRecipe.inputs.forEachIndexed { idx, ingredient ->
|
display.neuRecipe.inputs.forEachIndexed { idx, ingredient ->
|
||||||
add(
|
add(
|
||||||
Widgets.createSlot(
|
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))
|
).markInput().entry(SBItemEntryDefinition.getEntry(ingredient))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.Tooltip
|
||||||
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext
|
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext
|
||||||
import me.shedaniel.rei.api.common.entry.EntryStack
|
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 net.minecraft.client.util.math.MatrixStack
|
||||||
|
import moe.nea.notenoughupdates.rei.NEUReiPlugin.Companion.asItemEntry
|
||||||
|
|
||||||
object NEUItemEntryRenderer : EntryRenderer<NEUItem> {
|
object NEUItemEntryRenderer : EntryRenderer<NEUItem> {
|
||||||
override fun render(
|
override fun render(
|
||||||
@@ -19,16 +18,14 @@ object NEUItemEntryRenderer : EntryRenderer<NEUItem> {
|
|||||||
mouseY: Int,
|
mouseY: Int,
|
||||||
delta: Float
|
delta: Float
|
||||||
) {
|
) {
|
||||||
VanillaEntryTypes.ITEM.definition.renderer
|
matrices.push()
|
||||||
.render(
|
matrices.translate(0F, 0F, 100F)
|
||||||
entry.asItemEntry(),
|
entry.asItemEntry().render(matrices, bounds, mouseX, mouseY, delta)
|
||||||
matrices, bounds, mouseX, mouseY, delta
|
matrices.pop()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getTooltip(entry: EntryStack<NEUItem>, tooltipContext: TooltipContext): Tooltip? {
|
override fun getTooltip(entry: EntryStack<NEUItem>, tooltipContext: TooltipContext): Tooltip? {
|
||||||
return VanillaEntryTypes.ITEM.definition.renderer
|
return entry.asItemEntry().getTooltip(tooltipContext, false)
|
||||||
.getTooltip(entry.asItemEntry(), tooltipContext)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user