Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.codecraft.mod.container;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.codecraft.mod.tileentity.TileEntityCodeOven;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.ICrafting;
- import net.minecraft.inventory.Slot;
- import net.minecraft.inventory.SlotFurnace;
- public class ContainerCodeOven extends Container {
- private TileEntityCodeOven codeOven;
- public int lastBurnTime;
- public int lastCurrentItemBurnTime;
- public int lastCookTime;
- public ContainerCodeOven(InventoryPlayer inventory, TileEntityCodeOven tileentity){
- this.codeOven = tileentity;
- this.addSlotToContainer(new Slot(tileentity, 0, 56, 35));
- this.addSlotToContainer(new Slot(tileentity, 1, 8, 63));
- this.addSlotToContainer(new SlotFurnace(inventory.player, tileentity, 2, 116, 35));
- for(int i = 0; i < 3; i++){
- for(int j = 0; j < 9; j++){
- this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 94 + i * 18));
- }
- }
- for(int i = 0; i < 9; i++){
- this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
- }
- }
- public void addCraftingToCrafters(ICrafting icrafting){
- super.addCraftingToCrafters(icrafting);
- icrafting.sendProgressBarUpdate(this, 0, this.codeOven.cookTime);
- icrafting.sendProgressBarUpdate(this, 1, this.codeOven.burnTime);
- icrafting.sendProgressBarUpdate(this, 2, this.codeOven.currentItemBurnTime);
- }
- public void detectAndSendChanges(){
- super.detectAndSendChanges();
- for(int i = 0; i < this.crafters.size(); i++){
- ICrafting icrafting = (ICrafting) this.crafters.get(i);
- if(this.lastCookTime != this.codeOven.cookTime){
- icrafting.sendProgressBarUpdate(this, 0, this.codeOven.cookTime);
- }
- if(this.lastBurnTime != this.codeOven.burnTime){
- icrafting.sendProgressBarUpdate(this, 1, this.codeOven.burnTime);
- }
- if(this.lastCurrentItemBurnTime != this.codeOven.currentItemBurnTime){
- icrafting.sendProgressBarUpdate(this, 2, this.codeOven.currentItemBurnTime);
- }
- }
- this.lastCookTime = this.codeOven.cookTime;
- this.lastBurnTime = this.codeOven.burnTime;
- this.lastCurrentItemBurnTime = this.codeOven.currentItemBurnTime;
- }
- @SideOnly(Side.CLIENT)
- public void updateProgressBar(int slot, int newValue){
- }
- @Override
- public boolean canInteractWith(EntityPlayer var1) {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement