Skip to content

Commit

Permalink
call 'HandledScreen#close' when opening the render task screen to pre…
Browse files Browse the repository at this point in the history
…vent chests from being incorrectly displayed as open afterward (fixes #109)
  • Loading branch information
gliscowo committed Aug 29, 2024
1 parent 56ba3ea commit 8b87c11
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(HandledScreen.class)
public class HandledScreenMixin<T extends ScreenHandler> extends Screen {
public abstract class HandledScreenMixin<T extends ScreenHandler> extends Screen {

@Shadow
@Final
protected T handler;

@Shadow
public abstract void close();

protected HandledScreenMixin(Text title) {
super(title);
}
Expand All @@ -29,7 +32,9 @@ protected HandledScreenMixin(Text title) {
public void renderInventory(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
if (keyCode != GLFW.GLFW_KEY_F12 || !Screen.hasControlDown()) return;

this.close();
client.setScreen(new SelectRenderTaskScreen(handler.slots.stream().map(Slot::getStack).filter(stack -> !stack.isEmpty()).toList()));

cir.setReturnValue(false);
}

Expand Down

0 comments on commit 8b87c11

Please sign in to comment.