Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ContainerArcaneStorage extends Container {
- public TileEntityArcaneStorage arcaneStorage;
- /* Strings formatted as "Index: I is at: X: X, Y: Y", holds the location and index number of slots */
- public static String[] slotIndexLocations;
- public static String[] playerSlotIndexLocations = new String[28];
- /* End of Storage Strings */
- /* Definition of Storage Types */
- public static final int ARCANE_STORAGE_COLUMNS = 24;
- public static final int ARCANE_STORAGE_ROWS = 16;
- public static final int ARCANE_STORAGE_SIZE = ARCANE_STORAGE_COLUMNS * ARCANE_STORAGE_ROWS;
- /* End of Storage Types */
- public ContainerArcaneStorage(InventoryPlayer inventoryPlayer, TileEntityArcaneStorage tileEntityArcaneStorage) {
- arcaneStorage = tileEntityArcaneStorage;
- int arcaneStorageMeta = tileEntityArcaneStorage.blockMetadata;
- int baseX = 0;
- int baseY = 0;
- int playerInvBaseX = 0;
- int playerInvBaseY = 50;
- int buffer = 20;
- switch (arcaneStorageMeta) {
- case Metadata.ARCANE_CONTAINER_BASE:
- int[][] ARCANE_STORAGE_ARRAY = new int[ARCANE_STORAGE_ROWS][ARCANE_STORAGE_COLUMNS];
- slotIndexLocations = new String[ARCANE_STORAGE_COLUMNS * ARCANE_STORAGE_ROWS + 1];
- slotForger(ARCANE_STORAGE_ARRAY, baseX, baseY, buffer, tileEntityArcaneStorage);
- }
- addPlayerInventory(playerInvBaseX, playerInvBaseY, buffer, inventoryPlayer);
- }
- @Override
- public boolean canInteractWith(EntityPlayer entityPlayer) {
- return arcaneStorage.isUseableByPlayer(entityPlayer);
- }
- protected void slotForger(int storageArray[][], int baseX, int baseY, int buffer, TileEntityArcaneStorage tileEntityArcaneStorage) {
- int indexCounter = 1;
- for (int slotX = 0; slotX < storageArray.length; slotX++) {
- for (int slotY = 0; slotY < storageArray[slotX].length; slotY++) {
- int xCoord = (baseX + slotY * buffer);
- int yCoord = (baseY + slotX * buffer);
- int slotIndex = storageArray[slotX][slotY];
- slotIndexLocations[indexCounter] = String.format("Index: %05d is at: X: %05d, Y: %05d", indexCounter, xCoord, yCoord);
- addSlotToContainer(new Slot(tileEntityArcaneStorage, slotIndex, xCoord, yCoord));
- indexCounter++;
- }
- }
- }
- protected void addPlayerInventory(int baseX, int baseY, int buffer, InventoryPlayer inventoryPlayer) {
- int playerInvSize[][] = new int[3][9];
- int indexCounter = 1;
- for (int slotX = 0; slotX < playerInvSize.length; slotX++) {
- for (int slotY = 0; slotY < playerInvSize[slotX].length; slotY++) {
- int slotIndex = playerInvSize[slotX][slotY];
- int xCoord = (baseX + slotY * buffer);
- int yCoord = (baseY + slotX * buffer);
- playerSlotIndexLocations[indexCounter] = String.format("Index: %05d is at: X: %05d, Y: %05d", indexCounter, xCoord, yCoord);
- addSlotToContainer(new Slot(inventoryPlayer, slotIndex, xCoord, yCoord));
- indexCounter++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement