5 juil. 2015, 22:20
​package eryah.usefulthings.container;

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.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnaceFuel;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import eryah.usefulthings.recipes.CrusherRecipes;
import eryah.usefulthings.tileentity.TileEntityCrusher;

public class ContainerCrusher extends Container
{
    private final IInventory tileCrusher;
    private int field_178152_f;
    private int field_178153_g;
    private int field_178154_h;
    private int field_178155_i;
    private static final String __OBFID = "CL_00001748";

    public ContainerCrusher(TileEntityCrusher tileEntityCrusher, IInventory playerInv)
    {
        this.tileCrusher = playerInv;
        this.addSlotToContainer(new Slot(playerInv, 0, 56, 17));
        this.addSlotToContainer(new SlotFurnaceFuel(playerInv, 1, 56, 53));
        this.addSlotToContainer(new SlotResult(playerInv, 2, 116, 35));
        int i;

        for (i = 0; i < 3; ++i)
        {
            for (int j = 0; j < 9; ++j)
            {
                this.addSlotToContainer(new Slot(tileEntityCrusher, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for (i = 0; i < 9; ++i)
        {
            this.addSlotToContainer(new Slot(tileEntityCrusher, i, 8 + i * 18, 142));
        }
    }

/**
     * Add the given Listener to the list of Listeners. Method name is for legacy.
     */
    public void addCraftingToCrafters(ICrafting listener)
    {
        super.addCraftingToCrafters(listener);
        listener.func_175173_a(this, this.tileCrusher);
    }

    /**
     * Looks for changes made in the container, sends them to every listener.
     */
    public void detectAndSendChanges()
    {
        super.detectAndSendChanges();

        for (int i = 0; i < this.crafters.size(); ++i)
        {
            ICrafting icrafting = (ICrafting)this.crafters.get(i);

            if (this.field_178152_f != this.tileCrusher.getField(2))
            {
                icrafting.sendProgressBarUpdate(this, 2, this.tileCrusher.getField(2));
            }

            if (this.field_178154_h != this.tileCrusher.getField(0))
            {
                icrafting.sendProgressBarUpdate(this, 0, this.tileCrusher.getField(0));
            }

            if (this.field_178155_i != this.tileCrusher.getField(1))
            {
                icrafting.sendProgressBarUpdate(this, 1, this.tileCrusher.getField(1));
            }

            if (this.field_178153_g != this.tileCrusher.getField(3))
            {
                icrafting.sendProgressBarUpdate(this, 3, this.tileCrusher.getField(3));
            }
        }

        this.field_178152_f = this.tileCrusher.getField(2);
        this.field_178154_h = this.tileCrusher.getField(0);
        this.field_178155_i = this.tileCrusher.getField(1);
        this.field_178153_g = this.tileCrusher.getField(3);
    }

    @SideOnly(Side.CLIENT)
    public void updateProgressBar(int id, int data)
    {
        this.tileCrusher.setField(id, data);
    }

    public boolean canInteractWith(EntityPlayer playerIn)
    {
        return this.tileCrusher.isUseableByPlayer(playerIn);
    }

    /**
     * Take a stack from the specified inventory slot.
     */
    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(index);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (index == 2)
            {
                if (!this.mergeItemStack(itemstack1, 3, 39, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (index != 1 && index != 0)
            {
                if (CrusherRecipes.instance().getSmeltingResult(itemstack1) != null)
                {
                    if (!this.mergeItemStack(itemstack1, 0, 1, false))
                    {
                        return null;
                    }
                }
                else if (TileEntityCrusher.isItemFuel(itemstack1))
                {
                    if (!this.mergeItemStack(itemstack1, 1, 2, false))
                    {
                        return null;
                    }
                }
                else if (index >= 3 && index < 30)
                {
                    if (!this.mergeItemStack(itemstack1, 30, 39, false))
                    {
                        return null;
                    }
                }
                else if (index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
                {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 3, 39, false))
            {
                return null;
            }

            if (itemstack1.stackSize == 0)
            {
                slot.putStack((ItemStack)null);
            }
            else
            {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize)
            {
                return null;
            }

            slot.onPickupFromSlot(playerIn, itemstack1);
        }

        return itemstack;
    }
}

Il est pas mal touffu, j’ai donc juste fait un find, et j’ai rien trouvé de l’ancienne erreur