-
Notifications
You must be signed in to change notification settings - Fork 754
/
DrawbridgeSlot.java
45 lines (38 loc) · 1.11 KB
/
DrawbridgeSlot.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package tconstruct.inventory;
import tconstruct.blocks.logic.DrawbridgeLogic;
import tconstruct.library.TConstructRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class DrawbridgeSlot extends SlotBlocksOnly
{
DrawbridgeLogic logic;
public DrawbridgeSlot(IInventory iinventory, int par2, int par3, int par4, DrawbridgeLogic logic)
{
super(iinventory, par2, par3, par4);
this.logic = logic;
}
@Override
public boolean isItemValid (ItemStack par1ItemStack)
{
if (!super.isItemValid(par1ItemStack))
{
if (TConstructRegistry.blockToItemMapping[par1ItemStack.itemID] == 0)
{
return false;
}
}
return !logic.hasExtended();
}
@Override
public boolean canTakeStack (EntityPlayer par1EntityPlayer)
{
return !logic.hasExtended();
}
@Override
public int getSlotStackLimit ()
{
return inventory.getInventoryStackLimit();
}
}