-
Notifications
You must be signed in to change notification settings - Fork 497
/
PipeLogicDiamond.java
150 lines (120 loc) · 3.6 KB
/
PipeLogicDiamond.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.transport.pipes;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import buildcraft.BuildCraftTransport;
import buildcraft.api.inventory.ISpecialInventory;
import buildcraft.core.GuiIds;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.SimpleInventory;
import buildcraft.transport.BlockGenericPipe;
public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
private SimpleInventory filters = new SimpleInventory(54, "items", 1);
/* PIPE LOGIC */
@Override
public boolean doDrop() {
return false;
}
@Override
public boolean blockActivated(EntityPlayer entityplayer) {
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID < Block.blocksList.length)
if (Block.blocksList[entityplayer.getCurrentEquippedItem().itemID] instanceof BlockGenericPipe)
return false;
if (!CoreProxy.proxy.isRenderWorld(container.worldObj)) {
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_DIAMOND, container.worldObj, container.xCoord, container.yCoord, container.zCoord);
}
return true;
}
/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
filters.readFromNBT(nbttagcompound);
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
filters.writeToNBT(nbttagcompound);
}
/* ISPECIALINVENTORY */
@Override
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
return 0;
}
@Override
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
return new ItemStack[0];
}
/* IINVENTORY IMPLEMENTATION */
@Override
public int getSizeInventory() {
return filters.getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int i) {
return filters.getStackInSlot(i);
}
@Override
public String getInvName() {
return "Filters";
}
@Override
public int getInventoryStackLimit() {
return filters.getInventoryStackLimit();
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
return filters.getStackInSlotOnClosing(i);
}
@Override
public void onInventoryChanged() {
filters.onInventoryChanged();
}
@Override
public boolean isUseableByPlayer(EntityPlayer var1) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == container;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack stack = filters.decrStackSize(i, j);
if (CoreProxy.proxy.isSimulating(worldObj)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
filters.setInventorySlotContents(i, itemstack);
if (CoreProxy.proxy.isSimulating(worldObj)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@Override
public boolean func_94042_c()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean func_94041_b(int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
}