Fix JEI flickering
This commit is contained in:
parent
24805fb15f
commit
ab7473db6c
@ -444,7 +444,7 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
||||
result.add(Rect2f(absoluteX, absoluteY, width, height))
|
||||
|
||||
for (children in children) {
|
||||
if (children.isOutsideOfParent) {
|
||||
if (children.isOutsideOfParent && children.isVisible()) {
|
||||
result.addAll(children.calculateAbsoluteRectangles())
|
||||
}
|
||||
}
|
||||
@ -557,16 +557,36 @@ open class EditablePanel<out S : Screen> @JvmOverloads constructor(
|
||||
return false
|
||||
}
|
||||
|
||||
fun render(poseStack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
if (!isVisible()) {
|
||||
return
|
||||
}
|
||||
|
||||
fun performLayoutIfNeeded() {
|
||||
if (layoutInvalidated) {
|
||||
performLayout()
|
||||
} else if (boundsInvalidated) {
|
||||
updateBounds()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAbsoluteCoordinates() {
|
||||
if (parent == null) {
|
||||
absoluteX = x
|
||||
absoluteY = y
|
||||
}
|
||||
|
||||
for (child in children) {
|
||||
if (child.isVisible()) {
|
||||
child.absoluteX = absoluteX + child.x + xOffset
|
||||
child.absoluteY = absoluteY + child.y + yOffset
|
||||
|
||||
child.updateAbsoluteCoordinates()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun render(poseStack: PoseStack, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||
if (!isVisible()) {
|
||||
return
|
||||
}
|
||||
|
||||
performLayoutIfNeeded()
|
||||
|
||||
val parent = this.parent
|
||||
|
||||
|
@ -217,7 +217,7 @@ class JEIPlugin : IModPlugin {
|
||||
override fun registerGuiHandlers(registration: IGuiHandlerRegistration) {
|
||||
registration.addGenericGuiContainerHandler(MatteryScreen::class.java, object : IGuiContainerHandler<MatteryScreen<*>> {
|
||||
override fun getGuiExtraAreas(containerScreen: MatteryScreen<*>): MutableList<Rect2i> {
|
||||
return containerScreen.panelsView.stream().map { it.calculateAbsoluteRectangles() }.flatMap { it.stream() }.map { it.toIntRect() }.collect(Collectors.toList())
|
||||
return containerScreen.panelsView.stream().map { it.performLayoutIfNeeded(); it.updateAbsoluteCoordinates(); it.calculateAbsoluteRectangles() }.flatMap { it.stream() }.map { it.toIntRect() }.collect(Collectors.toList())
|
||||
}
|
||||
|
||||
override fun getIngredientUnderMouse(
|
||||
|
Loading…
Reference in New Issue
Block a user