Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
made locker and workbench guis completely dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 16, 2023
1 parent c65ab06 commit 05af473
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.github.gregtechintergalactical.gtutility.data;

import io.github.gregtechintergalactical.gtutility.GTUtility;
import io.github.gregtechintergalactical.gtutility.gui.slots.SlotCrafting;
import muramasa.antimatter.capability.item.EmptyContainer;
import muramasa.antimatter.gui.SlotType;
import muramasa.antimatter.gui.slot.AbstractSlot;
import muramasa.antimatter.machine.event.ContentEvent;
import muramasa.antimatter.tool.IAntimatterTool;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntity;
import tesseract.TesseractCapUtils;

Expand All @@ -16,9 +18,9 @@ public class SlotTypes {
return TesseractCapUtils.getEnergyHandler(tile, null).map(eh -> TesseractCapUtils.getEnergyHandlerItem(i).map(inner -> ((inner.getInputVoltage() | inner.getOutputVoltage()) <= (eh.getInputVoltage() | eh.getOutputVoltage()) )).orElse(false)).orElse(false) || i.getItem() instanceof IAntimatterTool || i.getItem().canBeDepleted();
}
return true;
}, ContentEvent.ITEM_INPUT_CHANGED);
public static SlotType<SlotCrafting> CRAFTING = new SlotType<>("crafting", (type, gui, item, i, d) -> new SlotCrafting(type, gui, item.getOrDefault(type, new EmptyContainer()), i, d.getX(), d.getY()), (t, i) -> true, ContentEvent.ITEM_INPUT_CHANGED);
public static SlotType<AbstractSlot<?>> PARK = new SlotType<>("park", (type, gui, item, i, d) -> new AbstractSlot<>(type, gui, item.getOrDefault(type, new EmptyContainer()), i, d.getX(), d.getY()), (t, i) -> true, ContentEvent.ITEM_INPUT_CHANGED);
}, ContentEvent.ITEM_INPUT_CHANGED, true, true, new ResourceLocation(GTUtility.ID, "electric_tool"));
public static SlotType<SlotCrafting> CRAFTING = new SlotType<>("crafting", (type, gui, item, i, d) -> new SlotCrafting(type, gui, item.getOrDefault(type, new EmptyContainer()), i, d.getX(), d.getY()), (t, i) -> true, ContentEvent.ITEM_INPUT_CHANGED, false, true, new ResourceLocation(GTUtility.ID, "crafting_output"));
public static SlotType<AbstractSlot<?>> PARK = new SlotType<>("park", (type, gui, item, i, d) -> new AbstractSlot<>(type, gui, item.getOrDefault(type, new EmptyContainer()), i, d.getX(), d.getY()), (t, i) -> true, ContentEvent.ITEM_INPUT_CHANGED, true, true, new ResourceLocation(GTUtility.ID, "park"));

public static void init(){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public LockerMachine(String domain, Material material, boolean charge) {
add(ENERGY, 80, 8).add(ENERGY, 80, 8 + (18)).add(ENERGY, 80, 8 + (2 * 18)).add(ENERGY, 80, 8 + (3 * 18));
}
this.setTile(BlockEntityLocker::new);
this.getGui().setOverrideLocation(new ResourceLocation(GTUtility.ID, "textures/gui/machine/" + (charge ? "charging_" : "") + "locker.png"));
AntimatterAPI.register(LockerMachine.class, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import io.github.gregtechintergalactical.gtutility.data.MenuHandlers;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.Ref;
import muramasa.antimatter.gui.ButtonOverlay;
import muramasa.antimatter.machine.MachineFlag;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.material.Material;
import muramasa.antimatter.texture.Texture;
import net.minecraft.resources.ResourceLocation;

import static io.github.gregtechintergalactical.gtutility.data.SlotTypes.*;
import static muramasa.antimatter.gui.ButtonBody.NO_OVERLAY;
import static muramasa.antimatter.gui.ButtonOverlay.NO_OVERLAY;
import static muramasa.antimatter.gui.SlotType.STORAGE;
import static muramasa.antimatter.machine.MachineFlag.*;

Expand All @@ -37,10 +38,9 @@ public WorkbenchMachine(String domain, Material material, boolean charge) {
}
this.add(PARK, 154, 46);
this.addGuiCallback(t -> {
t.addButton(136, 28, 16, 16, NO_OVERLAY);
t.addButton(154, 28, 16, 16, NO_OVERLAY);
t.addButton(136, 28, new ButtonOverlay(GTUtility.ID, "to_inv", 18, 18));
t.addButton(154, 28, new ButtonOverlay(GTUtility.ID, "to_player", 18, 18));
});
this.getGui().setOverrideLocation(new ResourceLocation(GTUtility.ID, "textures/gui/machine/" + (charge ? "charging_" : "") + "workbench.png"));
AntimatterAPI.register(WorkbenchMachine.class, this);
}
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 05af473

Please sign in to comment.