Convert even more

This commit is contained in:
skippyall
2026-04-05 01:17:53 +02:00
parent 7acd083e79
commit 324fea04a9
34 changed files with 858 additions and 278 deletions
@@ -0,0 +1,54 @@
package io.github.skippyall.minions.gui;
import net.minecraft.server.network.ServerPlayerEntity;
import org.jetbrains.annotations.Nullable;
public abstract class MinionsGui {
protected final @Nullable MinionsGui parent;
protected final ServerPlayerEntity viewer;
private @Nullable MinionsGui child = null;
private boolean open = true;
public MinionsGui(MinionsGui parent) {
this.viewer = parent.viewer;
this.parent = parent;
parent.child = this;
open();
}
public MinionsGui(ServerPlayerEntity viewer) {
this.viewer = viewer;
this.parent = null;
open();
}
protected void open() {}
protected void reopen() {
open();
}
public void onBackingClosed() {
if(child != null && child.open) {
return;
}
close();
}
public void close() {
if(open) {
if(child != null) {
child.close();
}
if(parent != null) {
parent.child = null;
parent.reopen();
}
onClose();
open = false;
}
}
protected void onClose() {}
}