From 0b025fe249946aed862f78b8d4a57170d5e3c3f0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 6 Jun 2016 22:09:23 +0200 Subject: [PATCH] Re-added invtweaks support for the storage crate --- .../mod/inventory/ContainerGiantChest.java | 2 + .../api/container/ChestContainer.java | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/main/java/invtweaks/api/container/ChestContainer.java diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java index c802de8d4..84e109656 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerGiantChest.java @@ -12,12 +12,14 @@ package de.ellpeck.actuallyadditions.mod.inventory; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; +import invtweaks.api.container.ChestContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +@ChestContainer(rowSize = 13, isLargeChest = true) public class ContainerGiantChest extends Container{ public final TileEntityGiantChest tileChest; diff --git a/src/main/java/invtweaks/api/container/ChestContainer.java b/src/main/java/invtweaks/api/container/ChestContainer.java new file mode 100644 index 000000000..9fa7dab7c --- /dev/null +++ b/src/main/java/invtweaks/api/container/ChestContainer.java @@ -0,0 +1,38 @@ +package invtweaks.api.container; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * A marker for containers that have a chest-like persistent storage component. Enables the Inventory Tweaks sorting + * buttons for this container. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ChestContainer { + // Set to true if the Inventory Tweaks sorting buttons should be shown for this container. + boolean showButtons() default true; + + // Size of a chest row + int rowSize() default 9; + + // Uses 'large chest' mode for sorting buttons + // (Renders buttons vertically down the right side of the GUI) + boolean isLargeChest() default false; + + // Annotation for method to get size of a chest row if it is not a fixed size for this container class + // Signature int func() + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @interface RowSizeCallback { + } + + // Annotation for method to get size of a chest row if it is not a fixed size for this container class + // Signature int func() + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @interface IsLargeCallback { + } +}