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
|
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import ggfab.GGItemList;
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.MTEHatchInput;
import gregtech.api.util.GTUtility;
public class MTEHatchSolidifier extends MTEHatchInput {
static final int moldSlot = 2;
static final ItemStack[] solidifierMolds = { ItemList.Shape_Mold_Bottle.get(1), ItemList.Shape_Mold_Plate.get(1),
ItemList.Shape_Mold_Ingot.get(1), ItemList.Shape_Mold_Casing.get(1), ItemList.Shape_Mold_Gear.get(1),
ItemList.Shape_Mold_Gear_Small.get(1), ItemList.Shape_Mold_Credit.get(1), ItemList.Shape_Mold_Nugget.get(1),
ItemList.Shape_Mold_Block.get(1), ItemList.Shape_Mold_Ball.get(1), ItemList.Shape_Mold_Cylinder.get(1),
ItemList.Shape_Mold_Anvil.get(1), ItemList.Shape_Mold_Arrow.get(1), ItemList.Shape_Mold_Rod.get(1),
ItemList.Shape_Mold_Bolt.get(1), ItemList.Shape_Mold_Round.get(1), ItemList.Shape_Mold_Screw.get(1),
ItemList.Shape_Mold_Ring.get(1), ItemList.Shape_Mold_Rod_Long.get(1), ItemList.Shape_Mold_Rotor.get(1),
ItemList.Shape_Mold_Turbine_Blade.get(1), ItemList.Shape_Mold_Pipe_Tiny.get(1),
ItemList.Shape_Mold_Pipe_Small.get(1), ItemList.Shape_Mold_Pipe_Medium.get(1),
ItemList.Shape_Mold_Pipe_Large.get(1), ItemList.Shape_Mold_Pipe_Huge.get(1),
ItemList.Shape_Mold_ToolHeadDrill.get(1),
GGItemList.Shape_One_Use_craftingToolFile.get(1), GGItemList.Shape_One_Use_craftingToolWrench.get(1),
GGItemList.Shape_One_Use_craftingToolCrowbar.get(1), GGItemList.Shape_One_Use_craftingToolWireCutter.get(1),
GGItemList.Shape_One_Use_craftingToolHardHammer.get(1), GGItemList.Shape_One_Use_craftingToolSoftHammer.get(1),
GGItemList.Shape_One_Use_craftingToolScrewdriver.get(1), GGItemList.Shape_One_Use_craftingToolSaw.get(1) };
public MTEHatchSolidifier(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier);
}
@Override
public String[] getDescription() {
return new String[] {
"Fluid Input with Mold for " + EnumChatFormatting.YELLOW + "Fluid Shaper" + EnumChatFormatting.RESET,
"Capacity: " + GTUtility.formatNumbers(getCapacity()) + "L",
"Added by: " + EnumChatFormatting.AQUA
+ "Quetz4l"
+ " - "
+ EnumChatFormatting.RED
+ "[GT++]"
+ EnumChatFormatting.RESET };
}
public MTEHatchSolidifier(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, getSlots(aTier), aTier, aDescription, aTextures);
}
private class MoldSlot extends BaseSlot {
public MoldSlot(IItemHandlerModifiable inventory, int index) {
super(inventory, index);
}
@Override
public boolean isItemValidPhantom(ItemStack stack) {
return super.isItemValidPhantom(stack) && getBaseMetaTileEntity().isItemValidForSlot(getSlotIndex(), stack);
}
}
@Override
public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
if (aIndex == moldSlot && aStack != null) {
for (final ItemStack itemStack : solidifierMolds) {
if (GTUtility.areStacksEqual(itemStack, aStack, true)) {
return true;
}
}
} else if (aIndex != moldSlot) {
return super.isItemValidForSlot(aIndex, aStack);
}
return false;
}
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTEHatchSolidifier(mName, mTier, mDescriptionArray, mTextures);
}
public ItemStack getMold() {
return this.getStackInSlot(moldSlot);
}
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
super.addUIWidgets(builder, buildContext);
builder.widget(
new SlotWidget(new MoldSlot(inventoryHandler, moldSlot)).setShiftClickPriority(-1)
.setPos(125, 35)
.setBackground(getGUITextureSet().getItemSlot(), GTUITextures.OVERLAY_SLOT_MOLD)
.setSize(18, 18));
}
@Override
public void onBlockDestroyed() {
super.onBlockDestroyed();
}
// for a drop-down form when the hatch is destroyed
@Override
public boolean isValidSlot(int aIndex) {
if (aIndex == moldSlot) return true;
else return super.isValidSlot(aIndex);
}
}
|