diff --git a/src/api/java/invtweaks/api/container/ChestContainer.java b/src/api/java/invtweaks/api/container/ChestContainer.java new file mode 100644 index 00000000..dc273777 --- /dev/null +++ b/src/api/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 persistant storage component. Enables the Inventroy 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) + public @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) + public @interface IsLargeCallback { + } +} \ No newline at end of file diff --git a/src/main/java/tconstruct/tools/inventory/PatternChestContainer.java b/src/main/java/tconstruct/tools/inventory/PatternChestContainer.java index 2a5dfa4a..66b87455 100644 --- a/src/main/java/tconstruct/tools/inventory/PatternChestContainer.java +++ b/src/main/java/tconstruct/tools/inventory/PatternChestContainer.java @@ -1,5 +1,6 @@ package tconstruct.tools.inventory; +import invtweaks.api.container.ChestContainer; import net.minecraft.block.Block; import net.minecraft.entity.player.*; import net.minecraft.inventory.*; @@ -8,6 +9,7 @@ import tconstruct.library.util.IPattern; import tconstruct.tools.TinkerTools; import tconstruct.tools.logic.PatternChestLogic; +@ChestContainer public class PatternChestContainer extends Container { public PatternChestLogic logic;