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
|
package gregtech.common.covers;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.network.play.server.S2DPacketOpenWindow;
import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.util.CoverBehavior;
import gregtech.api.util.ISerializableObject;
public class CoverCrafting extends CoverBehavior {
public CoverCrafting(ITexture coverTexture) {
super(coverTexture);
}
@Override
public boolean isRedstoneSensitive(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
long aTimer) {
return false;
}
@Override
public boolean onCoverRightclick(ForgeDirection side, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
EntityPlayer aPlayer, float aX, float aY, float aZ) {
if ((aPlayer instanceof EntityPlayerMP)) {
((EntityPlayerMP) aPlayer).getNextWindowId();
((EntityPlayerMP) aPlayer).playerNetServerHandler.sendPacket(
new S2DPacketOpenWindow(((EntityPlayerMP) aPlayer).currentWindowId, 1, "Crafting", 9, true));
aPlayer.openContainer = new ContainerWorkbench(
aPlayer.inventory,
aPlayer.worldObj,
aTileEntity.getXCoord(),
aTileEntity.getYCoord(),
aTileEntity.getZCoord()) {
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
};
aPlayer.openContainer.windowId = ((EntityPlayerMP) aPlayer).currentWindowId;
aPlayer.openContainer.addCraftingToCrafters((EntityPlayerMP) aPlayer);
}
return true;
}
@Override
protected boolean isGUIClickableImpl(ForgeDirection side, int aCoverID,
ISerializableObject.LegacyCoverData aCoverVariable, ICoverable aTileEntity) {
return false;
}
}
|