package com.yolp900.itsjustacharm.common.tileEntities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
public abstract class ModTileEntityIInventory extends ModTileEntity implements IInventory {
@Nullable
@Override
public ItemStack decrStackSize(int index, int amount) {
ItemStack stack = getStackInSlot(index);
if (stack != null) {
if (stack.stackSize <= amount) {
setInventorySlotContents(index, null);
} else {
stack = stack.splitStack(amount);
if (stack.stackSize == 0) {
setInventorySlotContents(index, null);
}
}
}
return stack;
}
@Override
@ParametersAreNonnullByDefault
public boolean isUseableByPlayer(EntityPlayer player) {
return worldObj.getTileEntity(pos) == this && player.getDistanceSq(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5) < 64;
}
@Override
@ParametersAreNonnullByDefault
public void openInventory(EntityPlayer player) {
}
@Override
@ParametersAreNonnullByDefault
public void closeInventory(EntityPlayer player) {
}
@Override
@ParametersAreNonnullByDefault
public abstract boolean isItemValidForSlot(int slot, ItemStack stack);
@Override
public int getField(int id) {
return 0;
}
@Override
public void setField(int id, int value) {
}
@Override
public int getFieldCount() {
return 0;
}
}