forked from SteamWar/SteamWar
Add click on SimulatorMaterialGui to change material
This commit is contained in:
+10
@@ -53,6 +53,16 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
|
||||
this.back = back;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOpen() {
|
||||
if (player.getItemOnCursor().getType().isAir()) {
|
||||
return true;
|
||||
}
|
||||
change.accept(player.getItemOnCursor().getType());
|
||||
SimulatorWatcher.update(simulator);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String baseTitle() {
|
||||
return "Material";
|
||||
|
||||
+6
@@ -46,6 +46,8 @@ public abstract class SimulatorBaseGui {
|
||||
}
|
||||
|
||||
public final void open() {
|
||||
if (!shouldOpen()) return;
|
||||
|
||||
String newTitle = title();
|
||||
String originalTitle = player.getOpenInventory().getTitle();
|
||||
|
||||
@@ -86,6 +88,10 @@ public abstract class SimulatorBaseGui {
|
||||
inventory.open();
|
||||
}
|
||||
|
||||
public boolean shouldOpen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
inventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§8", clickType -> {
|
||||
|
||||
Reference in New Issue
Block a user