restore compatibility with inventory tweaks
This commit is contained in:
parent
0d98200512
commit
103a22860b
|
@ -0,0 +1,28 @@
|
|||
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 {
|
||||
// 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 {
|
||||
}
|
||||
}
|
|
@ -16,7 +16,9 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import invtweaks.api.container.ChestContainer;
|
||||
|
||||
@ChestContainer(isLargeChest = true)
|
||||
public class ContainerIronChest extends Container {
|
||||
private IronChestType type;
|
||||
private EntityPlayer player;
|
||||
|
@ -115,4 +117,9 @@ public class ContainerIronChest extends Container {
|
|||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
@ChestContainer.RowSizeCallback
|
||||
public int getNumColumns() {
|
||||
return type.getRowLength();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue