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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
package gregtech.common.tileentities.machines.steam;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_GLOW;
import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import gregtech.api.enums.ParticleFX;
import gregtech.api.enums.SoundResource;
import gregtech.api.enums.TierEU;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.MTEBasicMachineBronze;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder;
public class MTESteamMaceratorBronze extends MTEBasicMachineBronze {
public MTESteamMaceratorBronze(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, "Macerating your Ores", 1, 1, false);
}
public MTESteamMaceratorBronze(String aName, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aDescription, aTextures, 1, 1, false);
}
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTESteamMaceratorBronze(this.mName, this.mDescriptionArray, this.mTextures);
}
@Override
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
if (aBaseMetaTileEntity.getFrontFacing() != ForgeDirection.UP
&& aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0
&& !aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP)) {
new ParticleEventBuilder().setMotion(0.0D, 0.0D, 0.0D)
.setIdentifier(ParticleFX.SMOKE)
.setPosition(
aBaseMetaTileEntity.getXCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F,
aBaseMetaTileEntity.getYCoord() + 0.9F + XSTR_INSTANCE.nextFloat() * 0.2F,
aBaseMetaTileEntity.getZCoord() + 0.8F - XSTR_INSTANCE.nextFloat() * 0.6F)
.setWorld(getBaseMetaTileEntity().getWorld())
.run();
}
}
}
@Override
public RecipeMap<?> getRecipeMap() {
return RecipeMaps.maceratorRecipes;
}
@Override
public int checkRecipe() {
GTRecipe tRecipe = getRecipeMap().findRecipeQuery()
.items(getAllInputs())
.voltage(TierEU.LV)
.cachedRecipe(mLastRecipe)
.find();
if (tRecipe == null) return DID_NOT_FIND_RECIPE;
if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
if (!canOutput(tRecipe)) {
mOutputBlocked++;
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
}
if (!tRecipe.isRecipeInputEqual(true, new FluidStack[] { getFillableStack() }, getAllInputs()))
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
if (tRecipe.getOutput(0) != null) mOutputItems[0] = tRecipe.getOutput(0);
calculateCustomOverclock(tRecipe);
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
@Override
protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side,
ItemStack aStack) {
return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, side, aStack)
&& RecipeMaps.maceratorRecipes.containsInput(GTUtility.copyAmount(64, aStack));
}
@Override
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
super.startSoundLoop(aIndex, aX, aY, aZ);
if (aIndex == 1) {
GTUtility.doSoundAtClient(SoundResource.IC2_MACHINES_MACERATOR_OP, 10, 1.0F, aX, aY, aZ);
}
}
@Override
public void startProcess() {
sendLoopStart((byte) 1);
}
@Override
public ITexture[] getSideFacingActive(byte aColor) {
return new ITexture[] { super.getSideFacingActive(aColor)[0],
TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE), TextureFactory.builder()
.addIcon(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getSideFacingInactive(byte aColor) {
return new ITexture[] { super.getSideFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR),
TextureFactory.builder()
.addIcon(OVERLAY_SIDE_STEAM_MACERATOR_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getFrontFacingActive(byte aColor) {
return new ITexture[] { super.getFrontFacingActive(aColor)[0],
TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE), TextureFactory.builder()
.addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getFrontFacingInactive(byte aColor) {
return new ITexture[] { super.getFrontFacingInactive(aColor)[0],
TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR), TextureFactory.builder()
.addIcon(OVERLAY_FRONT_STEAM_MACERATOR_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getTopFacingActive(byte aColor) {
return new ITexture[] { super.getTopFacingActive(aColor)[0],
TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE), TextureFactory.builder()
.addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getTopFacingInactive(byte aColor) {
return new ITexture[] { super.getTopFacingInactive(aColor)[0], TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR),
TextureFactory.builder()
.addIcon(OVERLAY_TOP_STEAM_MACERATOR_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getBottomFacingActive(byte aColor) {
return new ITexture[] { super.getBottomFacingActive(aColor)[0],
TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE), TextureFactory.builder()
.addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE_GLOW)
.glow()
.build() };
}
@Override
public ITexture[] getBottomFacingInactive(byte aColor) {
return new ITexture[] { super.getBottomFacingInactive(aColor)[0],
TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR), TextureFactory.builder()
.addIcon(OVERLAY_BOTTOM_STEAM_MACERATOR_GLOW)
.glow()
.build() };
}
}
|