Added Isided to IndustrialSawmill

This commit is contained in:
Gig 2015-06-08 23:32:46 +01:00
parent e569d625f8
commit 98329b2d01

View file

@ -5,15 +5,17 @@ import ic2.api.energy.tile.IEnergyTile;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.api.recipe.RecipeCrafter; import techreborn.api.recipe.RecipeCrafter;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.util.Inventory; import techreborn.util.Inventory;
import java.util.List; import java.util.List;
public class TileIndustrialSawmill extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory { public class TileIndustrialSawmill extends TileMachineBase implements IWrenchable, IEnergyTile, IInventory, ISidedInventory {
public int tickTime; public int tickTime;
public BasicSink energy; public BasicSink energy;
@ -187,5 +189,26 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl
public boolean isItemValidForSlot(int slot, ItemStack stack) { public boolean isItemValidForSlot(int slot, ItemStack stack) {
return inventory.isItemValidForSlot(slot, stack); return inventory.isItemValidForSlot(slot, stack);
} }
// ISidedInventory
@Override
public int[] getAccessibleSlotsFromSide(int side)
{
return side == ForgeDirection.DOWN.ordinal() ? new int[]{0, 1, 2, 3, 4} : new int[]{0, 1, 2, 3, 4};
}
@Override
public boolean canInsertItem(int slotIndex, ItemStack itemStack, int side)
{
if (slotIndex >= 2)
return false;
return isItemValidForSlot(slotIndex, itemStack);
}
@Override
public boolean canExtractItem(int slotIndex, ItemStack itemStack, int side)
{
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4;
}
} }