Guest User

ContainerForge

a guest
Mar 10th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. public class ContainerForge extends Container
  2. {
  3. private TileEntityForge forge;
  4.  
  5. public int lastBurnTime;
  6.  
  7. public int lastItemBurnTime;
  8.  
  9. public int lastCookTime;
  10.  
  11. public ContainerForge(InventoryPlayer inventory, TileEntityForge tileentity)
  12. {
  13. this.forge = tileentity;
  14.  
  15. this.addSlotToContainer(new Slot(tileentity, 0, 56, 17));
  16. this.addSlotToContainer(new Slot(tileentity, 1, 36, 17));
  17. this.addSlotToContainer(new Slot(tileentity, 2, 61, 17));
  18. this.addSlotToContainer(new Slot(tileentity, 3, 86, 17));
  19. this.addSlotToContainer(new Slot(tileentity, 4, 49, 53));
  20. this.addSlotToContainer(new SlotFurnace(inventory.player, tileentity, 5, 116, 35));
  21.  
  22. for(int i = 0; i < 3; i++)
  23. {
  24. for(int j = 0; j < 9; j++)
  25. {
  26. this.addSlotToContainer(new Slot(inventory, j + i*9 + 9, 8 + j*18, 84 + i*18));
  27. }
  28. }
  29.  
  30. for(int i = 0; i < 9; i++)
  31. {
  32. this.addSlotToContainer(new Slot(inventory, i, 8 + i*18, 142));
  33. }
  34. }
  35.  
  36. public void addCraftingToCrafters(ICrafting icrafting)
  37. {
  38. super.addCraftingToCrafters(icrafting);
  39. icrafting.sendProgressBarUpdate(this, 0, this.forge.cookTime);
  40. icrafting.sendProgressBarUpdate(this, 1, this.forge.cookTime);
  41. icrafting.sendProgressBarUpdate(this, 2, this.forge.cookTime);
  42. icrafting.sendProgressBarUpdate(this, 3, this.forge.cookTime);
  43. icrafting.sendProgressBarUpdate(this, 4, this.forge.burnTime);
  44. icrafting.sendProgressBarUpdate(this, 5, this.forge.currentItemBurnTime);
  45. }
  46.  
  47. public void detectAndSendChanges()
  48. {
  49. super.detectAndSendChanges();
  50. }
  51.  
  52. @SideOnly(Side.CLIENT)
  53. public void updateProgressBar(int slot, int newValue)
  54. {
  55. if(slot == 0) this.forge.cookTime = newValue;
  56. if(slot == 1) this.forge.cookTime = newValue;
  57. if(slot == 2) this.forge.cookTime = newValue;
  58. if(slot == 3) this.forge.cookTime = newValue;
  59. if(slot == 4) this.forge.burnTime = newValue;
  60. if(slot == 5) this.forge.currentItemBurnTime = newValue;
  61.  
  62. }
  63.  
  64. public ItemStack transferStackInSlot(EntityPlayer player, int slot)
  65. {
  66. return null;
  67. }
  68.  
  69. public boolean canInteractWith(EntityPlayer entityplayer)
  70. {
  71. return this.forge.isUseableByPlayer(entityplayer);
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment