Advertisement
Guest User

ContainerFurnace

a guest
Jan 31st, 2014
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.20 KB | None | 0 0
  1. package net.scratchforfun.mod.gui;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.entity.player.InventoryPlayer;
  7. import net.minecraft.inventory.Container;
  8. import net.minecraft.inventory.ICrafting;
  9. import net.minecraft.inventory.Slot;
  10. import net.minecraft.inventory.SlotFurnace;
  11. import net.minecraft.item.ItemStack;
  12. import net.scratchforfun.mod.tileentity.TileEntityQuartzFurnace;
  13.  
  14. public class ContainerQuartzFurnace extends Container {
  15.  
  16.     private TileEntityQuartzFurnace quartzFurnace;
  17.     public int lastBurnTime;
  18.     public int lastItemBurnTime;
  19.     public int lastCookTime;
  20.    
  21.     public ContainerQuartzFurnace(InventoryPlayer inventory, TileEntityQuartzFurnace tileentity){
  22.         this.quartzFurnace = tileentity;
  23.        
  24.         this.addSlotToContainer(new Slot(tileentity, 0, 56, 17));
  25.         this.addSlotToContainer(new Slot(tileentity, 1, 56, 53));
  26.         this.addSlotToContainer(new SlotFurnace(inventory.player, tileentity, 2, 116, 35 ));
  27.        
  28.         for(int i = 0; i< 3; i++){
  29.             for(int j = 0; j < 9; j++){
  30.                 this.addSlotToContainer(new Slot(inventory, j + i*9 + 9, 8 + j * 18, 84 + i * 18));
  31.             }
  32.         }
  33.        
  34.         for(int i = 0; i < 9; i++){
  35.             this.addSlotToContainer(new Slot(inventory, i, 8 + i*18, 142));
  36.         }
  37.     }
  38.     @Override
  39.     public void addCraftingToCrafters(ICrafting icrafting){
  40.         super.addCraftingToCrafters(icrafting);
  41.         icrafting.sendProgressBarUpdate(this, 0, this.quartzFurnace.cookTime);
  42.         icrafting.sendProgressBarUpdate(this, 1, this.quartzFurnace.burnTime);
  43.         icrafting.sendProgressBarUpdate(this, 2, this.quartzFurnace.currentItemBurnTime);
  44.     }
  45.    
  46.     public void detectAndSendChanges(){
  47.         super.detectAndSendChanges();
  48.     }
  49.    
  50.     @SideOnly(Side.CLIENT)
  51.     public void updateProgressBar(int slot, int newValue){
  52.         if(slot == 0) this.quartzFurnace.cookTime = newValue;
  53.         if(slot == 1) this.quartzFurnace.burnTime = newValue;
  54.         if(slot == 2) this.quartzFurnace.currentItemBurnTime = newValue;
  55.     }
  56.    
  57.     public ItemStack transferStackInSlot(EntityPlayer player, int slot){
  58.         return null;
  59.     }
  60.    
  61.     @Override
  62.     public boolean canInteractWith(EntityPlayer entityplayer) {
  63.         return this.quartzFurnace.isUseableByPlayer(entityplayer);
  64.     }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement