aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/interfaces
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2021-12-02 16:53:40 +0100
committerGitHub <noreply@github.com>2021-12-02 16:53:40 +0100
commitc0a6800447fdb87e266acfb47f35b5f765c74fe3 (patch)
tree2066554d22848e6818689d41cd4ca7f683ebebb7 /src/main/java/gregtech/api/interfaces
parent03b6fb248b1a20b9ccce7ac4da4c1a76875fa966 (diff)
downloadGT5-Unofficial-c0a6800447fdb87e266acfb47f35b5f765c74fe3.tar.gz
GT5-Unofficial-c0a6800447fdb87e266acfb47f35b5f765c74fe3.tar.bz2
GT5-Unofficial-c0a6800447fdb87e266acfb47f35b5f765c74fe3.zip
add select circuit gui for machine and circuits itself (#773)
also fixed some issue with basic machine gui introduced in 9d42b299def1c41bbc7a1f01efe445be28f54399 also retrofitted volumetric flask to use the new INetworkUpdatableItem and GT_Packet_UpdateItem, deprecating MessageSetFlaskCapacity in the meanwhile. To open the gui for machine, shift-left-click the circuit slot To open the gui for circuit, click any block (need to be sneaking if it's chest, furnace, etc) with the circuit held in hand. Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> Co-authored-by: Glease <4586901+Glease@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/interfaces')
-rw-r--r--src/main/java/gregtech/api/interfaces/IGuiScreen.java1
-rw-r--r--src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java23
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/interfaces/IGuiScreen.java b/src/main/java/gregtech/api/interfaces/IGuiScreen.java
index d0089afbb8..5f1ae9cd2b 100644
--- a/src/main/java/gregtech/api/interfaces/IGuiScreen.java
+++ b/src/main/java/gregtech/api/interfaces/IGuiScreen.java
@@ -10,6 +10,7 @@ public interface IGuiScreen {
interface IGuiElement {
void onInit();
+ default void onRemoved() {}
void draw(int mouseX, int mouseY, float parTicks);
}
diff --git a/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java
new file mode 100644
index 0000000000..2e102e937c
--- /dev/null
+++ b/src/main/java/gregtech/api/interfaces/INetworkUpdatableItem.java
@@ -0,0 +1,23 @@
+package gregtech.api.interfaces;
+
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+/**
+ * Together with {@link gregtech.api.net.GT_Packet_UpdateItem} you can request server side to update item in hand with
+ * a NBT tag.
+ *
+ * Usual NBT tag size limit applies.
+ */
+public interface INetworkUpdatableItem {
+ /**
+ * Receive update from client. Runs on server thread.
+ * @param stack Stack being updated
+ * @param player player holding the stack
+ * @param tag received data
+ * @return true if this stack should be kept inside the player inventory.
+ * false if this stack should vanish (i.e. slot content set to null)
+ */
+ boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag);
+}