Advertisement
Guest User

furnaceContainer

a guest
Apr 23rd, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.52 KB | None | 0 0
  1. package net.codecraft.mod.container;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.codecraft.mod.tileentity.TileEntityCodeOven;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.entity.player.InventoryPlayer;
  8. import net.minecraft.inventory.Container;
  9. import net.minecraft.inventory.ICrafting;
  10. import net.minecraft.inventory.Slot;
  11. import net.minecraft.inventory.SlotFurnace;
  12.  
  13. public class ContainerCodeOven extends Container {
  14.  
  15.     private TileEntityCodeOven codeOven;
  16.    
  17.     public int lastBurnTime;
  18.     public int lastCurrentItemBurnTime;
  19.     public int lastCookTime;
  20.    
  21.     public ContainerCodeOven(InventoryPlayer inventory, TileEntityCodeOven tileentity){
  22.         this.codeOven = tileentity;
  23.        
  24.         this.addSlotToContainer(new Slot(tileentity, 0, 56, 35));
  25.         this.addSlotToContainer(new Slot(tileentity, 1, 8, 63));
  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, 94 + 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.    
  39.     public void addCraftingToCrafters(ICrafting icrafting){
  40.         super.addCraftingToCrafters(icrafting);
  41.         icrafting.sendProgressBarUpdate(this, 0, this.codeOven.cookTime);
  42.         icrafting.sendProgressBarUpdate(this, 1, this.codeOven.burnTime);
  43.         icrafting.sendProgressBarUpdate(this, 2, this.codeOven.currentItemBurnTime);
  44.     }
  45.    
  46.     public void detectAndSendChanges(){
  47.         super.detectAndSendChanges();
  48.         for(int i = 0; i < this.crafters.size(); i++){
  49.             ICrafting icrafting = (ICrafting) this.crafters.get(i);
  50.            
  51.             if(this.lastCookTime != this.codeOven.cookTime){
  52.                 icrafting.sendProgressBarUpdate(this, 0, this.codeOven.cookTime);
  53.             }
  54.            
  55.             if(this.lastBurnTime != this.codeOven.burnTime){
  56.                 icrafting.sendProgressBarUpdate(this, 1, this.codeOven.burnTime);
  57.             }
  58.            
  59.             if(this.lastCurrentItemBurnTime != this.codeOven.currentItemBurnTime){
  60.                 icrafting.sendProgressBarUpdate(this, 2, this.codeOven.currentItemBurnTime);
  61.             }
  62.         }
  63.        
  64.         this.lastCookTime = this.codeOven.cookTime;
  65.         this.lastBurnTime = this.codeOven.burnTime;
  66.         this.lastCurrentItemBurnTime = this.codeOven.currentItemBurnTime;
  67.     }
  68.    
  69.     @SideOnly(Side.CLIENT)
  70.     public void updateProgressBar(int slot, int newValue){
  71.        
  72.     }
  73.    
  74.    
  75.    
  76.    
  77.    
  78.    
  79.    
  80.     @Override
  81.     public boolean canInteractWith(EntityPlayer var1) {
  82.         return true;
  83.     }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement