Skip to content

Commit 182ca25

Browse files
committed
update for gtnh 2.8.0
1 parent 3c4851d commit 182ca25

File tree

6 files changed

+125
-52
lines changed

6 files changed

+125
-52
lines changed

src/main/java/com/hepdd/easytech/api/metatileentity/implementations/ETHPrimitiveHatchInput.java

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import net.minecraft.init.Blocks;
66
import net.minecraft.item.ItemStack;
7+
import net.minecraft.nbt.NBTTagCompound;
78
import net.minecraftforge.common.util.ForgeDirection;
89

910
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -29,6 +30,9 @@ public ETHPrimitiveHatchInput(int aID, int aSlot, String aName, String aNameRegi
2930
AuthorEasyTechForItem });
3031
}
3132

33+
private int texturePage = 0;
34+
private int textureIndex = 0;
35+
3236
public ETHPrimitiveHatchInput(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
3337
super(aName, aTier, aDescription, aTextures);
3438
}
@@ -41,13 +45,10 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
4145
@Override
4246
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing,
4347
int colorIndex, boolean aActive, boolean redstoneLevel) {
44-
int texturePointer = getUpdateData(); // just to be sure, from my testing the 8th bit cannot be
45-
// set clientside
46-
int textureIndex = texturePointer | (getmTexturePage() << 7); // Shift seven since one page is 128 textures!
4748

4849
ITexture background;
49-
if (textureIndex > 0) {
50-
background = Textures.BlockIcons.casingTexturePages[getmTexturePage()][texturePointer];
50+
if (texturePage > 0 || textureIndex > 0) {
51+
background = Textures.BlockIcons.casingTexturePages[texturePage][textureIndex];
5152
} else {
5253
background = TextureFactory.of(Blocks.stonebrick);
5354
}
@@ -84,4 +85,27 @@ public int getCapacity() {
8485
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
8586
super.addUIWidgets(builder, buildContext);
8687
}
88+
89+
@Override
90+
public void loadNBTData(NBTTagCompound aNBT) {
91+
super.loadNBTData(aNBT);
92+
texturePage = aNBT.getInteger("texturePage");
93+
textureIndex = aNBT.getInteger("textureIndex");
94+
95+
myupdateTexture(texturePage << 7 | textureIndex);
96+
}
97+
98+
@Override
99+
public void onDescriptionPacket(NBTTagCompound data) {
100+
super.onDescriptionPacket(data);
101+
texturePage = data.getInteger("texturePage");
102+
textureIndex = data.getInteger("textureIndex");
103+
}
104+
105+
public final void myupdateTexture(int id) {
106+
texturePage = id >> 7;
107+
textureIndex = id & 127;
108+
109+
updateTexture(id);
110+
}
87111
}

src/main/java/com/hepdd/easytech/api/metatileentity/implementations/ETHPrimitiveHatchInputBus.java

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import static com.hepdd.easytech.loaders.preload.ETHStatics.AuthorEasyTechForItem;
44

5-
import net.minecraft.entity.player.EntityPlayer;
65
import net.minecraft.init.Blocks;
76
import net.minecraft.item.ItemStack;
7+
import net.minecraft.nbt.NBTTagCompound;
88
import net.minecraftforge.common.util.ForgeDirection;
99

1010
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -29,6 +29,9 @@ public ETHPrimitiveHatchInputBus(int id, String name, String nameRegional, int t
2929
new String[] { "Item Input for Multiblocks", "Capacity: 1 stack", AuthorEasyTechForItem });
3030
}
3131

32+
private int texturePage = 0;
33+
private int textureIndex = 0;
34+
3235
public ETHPrimitiveHatchInputBus(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
3336
super(aName, aTier, aDescription, aTextures);
3437
}
@@ -41,13 +44,10 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
4144
@Override
4245
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing,
4346
int colorIndex, boolean aActive, boolean redstoneLevel) {
44-
int texturePointer = getUpdateData(); // just to be sure, from my testing the 8th bit cannot be
45-
// set clientside
46-
int textureIndex = texturePointer | (getmTexturePage() << 7); // Shift seven since one page is 128 textures!
4747

4848
ITexture background;
49-
if (textureIndex > 0) {
50-
background = Textures.BlockIcons.casingTexturePages[getmTexturePage()][texturePointer];
49+
if (texturePage > 0 || textureIndex > 0) {
50+
background = Textures.BlockIcons.casingTexturePages[texturePage][textureIndex];
5151
} else {
5252
background = TextureFactory.of(Blocks.stonebrick);
5353
}
@@ -76,9 +76,6 @@ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex
7676
&& (disableLimited || limitedAllowPutStack(aIndex, aStack));
7777
}
7878

79-
@Override
80-
public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {}
81-
8279
@Override
8380
public boolean allowSelectCircuit() {
8481
return false;
@@ -88,4 +85,27 @@ public boolean allowSelectCircuit() {
8885
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
8986
getBaseMetaTileEntity().add1by1Slot(builder);
9087
}
88+
89+
@Override
90+
public void loadNBTData(NBTTagCompound aNBT) {
91+
super.loadNBTData(aNBT);
92+
texturePage = aNBT.getInteger("texturePage");
93+
textureIndex = aNBT.getInteger("textureIndex");
94+
95+
myupdateTexture(texturePage << 7 | textureIndex);
96+
}
97+
98+
@Override
99+
public void onDescriptionPacket(NBTTagCompound data) {
100+
super.onDescriptionPacket(data);
101+
texturePage = data.getInteger("texturePage");
102+
textureIndex = data.getInteger("textureIndex");
103+
}
104+
105+
public final void myupdateTexture(int id) {
106+
texturePage = id >> 7;
107+
textureIndex = id & 127;
108+
109+
updateTexture(id);
110+
}
91111
}

src/main/java/com/hepdd/easytech/api/metatileentity/implementations/ETHPrimitiveHatchOutput.java

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import static com.hepdd.easytech.loaders.preload.ETHStatics.AuthorEasyTechForItem;
44

5-
import net.minecraft.entity.player.EntityPlayer;
65
import net.minecraft.init.Blocks;
76
import net.minecraft.item.ItemStack;
7+
import net.minecraft.nbt.NBTTagCompound;
88
import net.minecraftforge.common.util.ForgeDirection;
99

1010
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -33,6 +33,9 @@ public ETHPrimitiveHatchOutput(int aID, String aName, String aNameRegional, int
3333
1);
3434
}
3535

36+
private int texturePage = 0;
37+
private int textureIndex = 0;
38+
3639
public ETHPrimitiveHatchOutput(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
3740
super(aName, aTier, aDescription, aTextures);
3841
}
@@ -57,19 +60,13 @@ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex
5760
@Override
5861
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {}
5962

60-
@Override
61-
public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {}
62-
6363
@Override
6464
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing,
6565
int colorIndex, boolean aActive, boolean redstoneLevel) {
66-
int texturePointer = getUpdateData(); // just to be sure, from my testing the 8th bit cannot be
67-
// set clientside
68-
int textureIndex = texturePointer | (getmTexturePage() << 7); // Shift seven since one page is 128 textures!
6966

7067
ITexture background;
71-
if (textureIndex > 0) {
72-
background = Textures.BlockIcons.casingTexturePages[getmTexturePage()][texturePointer];
68+
if (texturePage > 0 || textureIndex > 0) {
69+
background = Textures.BlockIcons.casingTexturePages[texturePage][textureIndex];
7370
} else {
7471
background = TextureFactory.of(Blocks.stonebrick);
7572
}
@@ -119,4 +116,27 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont
119116
.setDefaultColor(COLOR_TEXT_WHITE.get())
120117
.setPos(10, 30));
121118
}
119+
120+
@Override
121+
public void loadNBTData(NBTTagCompound aNBT) {
122+
super.loadNBTData(aNBT);
123+
texturePage = aNBT.getInteger("texturePage");
124+
textureIndex = aNBT.getInteger("textureIndex");
125+
126+
myupdateTexture(texturePage << 7 | textureIndex);
127+
}
128+
129+
@Override
130+
public void onDescriptionPacket(NBTTagCompound data) {
131+
super.onDescriptionPacket(data);
132+
texturePage = data.getInteger("texturePage");
133+
textureIndex = data.getInteger("textureIndex");
134+
}
135+
136+
public final void myupdateTexture(int id) {
137+
texturePage = id >> 7;
138+
textureIndex = id & 127;
139+
140+
updateTexture(id);
141+
}
122142
}

src/main/java/com/hepdd/easytech/api/metatileentity/implementations/ETHPrimitiveHatchOutputBus.java

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import net.minecraft.init.Blocks;
66
import net.minecraft.item.ItemStack;
7+
import net.minecraft.nbt.NBTTagCompound;
78
import net.minecraftforge.common.util.ForgeDirection;
89

910
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -28,6 +29,9 @@ public ETHPrimitiveHatchOutputBus(int aID, String aName, String aNameRegional, i
2829
1);
2930
}
3031

32+
private int texturePage = 0;
33+
private int textureIndex = 0;
34+
3135
public ETHPrimitiveHatchOutputBus(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
3236
super(aName, aTier, aDescription, aTextures);
3337
}
@@ -40,13 +44,10 @@ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
4044
@Override
4145
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing,
4246
int colorIndex, boolean aActive, boolean redstoneLevel) {
43-
int texturePointer = getUpdateData(); // just to be sure, from my testing the 8th bit cannot be
44-
// set clientside
45-
int textureIndex = texturePointer | (getmTexturePage() << 7); // Shift seven since one page is 128 textures!
4647

4748
ITexture background;
48-
if (textureIndex > 0) {
49-
background = Textures.BlockIcons.casingTexturePages[getmTexturePage()][texturePointer];
49+
if (texturePage > 0 || textureIndex > 0) {
50+
background = Textures.BlockIcons.casingTexturePages[texturePage][textureIndex];
5051
} else {
5152
background = TextureFactory.of(Blocks.stonebrick);
5253
}
@@ -75,4 +76,27 @@ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aInde
7576
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
7677
getBaseMetaTileEntity().add1by1Slot(builder);
7778
}
79+
80+
@Override
81+
public void loadNBTData(NBTTagCompound aNBT) {
82+
super.loadNBTData(aNBT);
83+
texturePage = aNBT.getInteger("texturePage");
84+
textureIndex = aNBT.getInteger("textureIndex");
85+
86+
myupdateTexture(texturePage << 7 | textureIndex);
87+
}
88+
89+
@Override
90+
public void onDescriptionPacket(NBTTagCompound data) {
91+
super.onDescriptionPacket(data);
92+
texturePage = data.getInteger("texturePage");
93+
textureIndex = data.getInteger("textureIndex");
94+
}
95+
96+
public final void myupdateTexture(int id) {
97+
texturePage = id >> 7;
98+
textureIndex = id & 127;
99+
100+
updateTexture(id);
101+
}
78102
}

src/main/java/com/hepdd/easytech/api/metatileentity/implementations/base/ETHVoidMinerBase.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.util.stream.Collectors;
1919

2020
import net.minecraft.block.Block;
21-
import net.minecraft.entity.player.EntityPlayer;
2221
import net.minecraft.item.Item;
2322
import net.minecraft.item.ItemStack;
2423
import net.minecraft.nbt.NBTTagCompound;
@@ -329,11 +328,6 @@ public int getDamageToComponent(ItemStack aStack) {
329328
return 0;
330329
}
331330

332-
@Override
333-
public boolean explodesOnComponentBreak(ItemStack aStack) {
334-
return false;
335-
}
336-
337331
@Override
338332
public ChunkCoordIntPair getActiveChunk() {
339333
return mCurrentChunk;
@@ -347,11 +341,11 @@ public void construct(ItemStack stackSize, boolean hintsOnly) {
347341
@Override
348342
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
349343
if (mMachine) return -1;
350-
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 6, 0, elementBudget, env, false, true);
344+
return survivalBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 6, 0, elementBudget, env, false, true);
351345
}
352346

353347
@Override
354-
protected boolean showRecipeTextInGUI() {
348+
public boolean showRecipeTextInGUI() {
355349
return false;
356350
}
357351

@@ -564,12 +558,6 @@ protected List<IHatchElement<? super ETHVoidMinerBase>> getAllowedHatches() {
564558
return ImmutableList.of(InputBus, OutputBus, Maintenance, Energy);
565559
}
566560

567-
@Override
568-
public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
569-
this.mBlacklist = !this.mBlacklist;
570-
GTUtility.sendChatToPlayer(aPlayer, "Mode: " + (this.mBlacklist ? "Blacklist" : "Whitelist"));
571-
}
572-
573561
@Override
574562
protected MultiblockTooltipBuilder createTooltip() {
575563
String casings = this.getCasingBlockItem()

src/main/java/com/hepdd/easytech/api/objects/GTChunkManagerEx.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class GTChunkManagerEx
2828
public static GTChunkManagerEx instance = new GTChunkManagerEx();
2929

3030
public static void init() {
31-
ForgeChunkManager.setForcedChunkLoadingCallback(GTMod.instance, instance);
31+
ForgeChunkManager.setForcedChunkLoadingCallback(GTMod.GT, instance);
3232
}
3333

3434
@Override
@@ -115,10 +115,10 @@ public static boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair
115115
ForgeChunkManager.forceChunk(instance.registeredTickets.get(owner), chunkXZ);
116116
} else {
117117
ForgeChunkManager.Ticket ticket;
118-
if (player.isEmpty()) ticket = ForgeChunkManager
119-
.requestTicket(GTMod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL);
118+
if (player.isEmpty())
119+
ticket = ForgeChunkManager.requestTicket(GTMod.GT, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL);
120120
else ticket = ForgeChunkManager
121-
.requestPlayerTicket(GTMod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL);
121+
.requestPlayerTicket(GTMod.GT, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL);
122122
if (ticket == null) {
123123
if (GTValues.debugChunkloaders)
124124
GTLog.out.println("GTChunkManager: ForgeChunkManager.requestTicket failed");
@@ -158,12 +158,9 @@ public static boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair
158158
} else {
159159
ForgeChunkManager.Ticket ticket;
160160
if (player.isEmpty()) ticket = ForgeChunkManager
161-
.requestTicket(GTMod.instance, DimensionManager.getWorld(dimId), ForgeChunkManager.Type.NORMAL);
162-
else ticket = ForgeChunkManager.requestPlayerTicket(
163-
GTMod.instance,
164-
player,
165-
DimensionManager.getWorld(dimId),
166-
ForgeChunkManager.Type.NORMAL);
161+
.requestTicket(GTMod.GT, DimensionManager.getWorld(dimId), ForgeChunkManager.Type.NORMAL);
162+
else ticket = ForgeChunkManager
163+
.requestPlayerTicket(GTMod.GT, player, DimensionManager.getWorld(dimId), ForgeChunkManager.Type.NORMAL);
167164
if (ticket == null) {
168165
if (GTValues.debugChunkloaders)
169166
GTLog.out.println("GTChunkManager: ForgeChunkManager.requestTicket failed");

0 commit comments

Comments
 (0)