Advertisement
Guest User

Untitled

a guest
Feb 9th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.60 KB | None | 0 0
  1. package com.nextlevelminecraft.cad435.ClientDependencies.GUI.GliderGui;
  2.  
  3. import com.nextlevelminecraft.cad435.ClientDependencies.GliderFramework.GliderInventory;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraft.entity.player.InventoryPlayer;
  6. import net.minecraft.inventory.Container;
  7. import net.minecraft.inventory.IInventory;
  8. import net.minecraft.inventory.Slot;
  9. import net.minecraft.item.ItemStack;
  10.  
  11.  
  12.  
  13. //Slot handling
  14. public class GliderGuiContainer extends Container {
  15.  
  16.     public IInventory PlanInv;
  17.     EntityPlayer player;
  18.  
  19.  
  20.  
  21.     public GliderGuiContainer(InventoryPlayer inventoryPlayer, EntityPlayer _player)
  22.     {
  23.         player = _player;
  24.         PlanInv = new GliderInventory(player.getEntityWorld(),player.posX,player.posY,player.posZ);
  25.  
  26.         //Stick places
  27.         addSlotToContainer(new Slot(PlanInv, 0, -14, 10));
  28.         addSlotToContainer(new Slot(PlanInv, 1, -14, 40));
  29.         addSlotToContainer(new Slot(PlanInv, 2, -14, 70));
  30.         //Belt Places
  31.         addSlotToContainer(new Slot(PlanInv, 3, 39, 63));
  32.         addSlotToContainer(new Slot(PlanInv, 4, 67, 63));
  33.         addSlotToContainer(new Slot(PlanInv, 5, 96, 63));
  34.  
  35.         //Wings
  36.         addSlotToContainer(new Slot(PlanInv, 6, 90, 6));
  37.         addSlotToContainer(new Slot(PlanInv, 7, 31, -5));
  38.  
  39.         //End-Product
  40.         addSlotToContainer(new Slot(PlanInv, 8, 165, 29));
  41.  
  42.         //Normal Player Inv
  43.         bindPlayerInventory(inventoryPlayer);
  44.     }
  45.  
  46.  
  47.     protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
  48.  
  49.  
  50.         //Use-Bar
  51.         for (int i = 0; i < 9; i++) {
  52.             addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142 + 24));
  53.             //System.out.println(i);
  54.         }
  55.         //Player-Inventory
  56.         for (int i = 0; i < 3; i++) {
  57.             for (int j = 0; j < 9; j++) {
  58.                 addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
  59.                         8 + j * 18, 84 + 24 + i * 18));
  60.             }
  61.         }
  62.     }
  63.  
  64.  
  65.     @Override
  66.     public boolean canInteractWith(EntityPlayer p_75145_1_) {
  67.         return true;
  68.     }
  69.  
  70.    @Override
  71.     public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
  72.  
  73.        //TODO: do the transfer
  74.         return null;
  75.     }
  76.  
  77.  
  78.     @Override
  79.     public void onContainerClosed(EntityPlayer p_75134_1_)
  80.     {
  81.         PlanInv.closeInventory();
  82.         super.onContainerClosed(p_75134_1_);
  83.     }
  84.  
  85.     //Todo: validate if item can stay in slot
  86.  
  87.     //Todo: Testing on server: drop remaining item(s) on close
  88.  
  89.     //Todo: destroy Plan on crafting success
  90.  
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement