Skip to content

Commit 3568c6a

Browse files
committed
general fix
1 parent 695a03d commit 3568c6a

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

src/main/java/com/Nxer/TwistSpaceTechnology/common/machine/GT_TileEntity_IndustrialMagicMatrix.java

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,13 @@ public class GT_TileEntity_IndustrialMagicMatrix extends GTCM_MultiMachineBase<G
9696

9797
// region default value
9898

99-
private int mParallel;
100-
private int ExtraTime;
101-
private double mSpeedBonus;
102-
private double Mean;
103-
private double Variance;
104-
private final TST_ItemID EssentiaCell_Creative = TST_ItemID
99+
protected int mParallel;
100+
protected int blockTier;
101+
protected int ExtraTime;
102+
protected double mSpeedBonus;
103+
protected double Mean;
104+
protected double Variance;
105+
protected final TST_ItemID EssentiaCell_Creative = TST_ItemID
105106
.create(EnumEssentiaStorageTypes.Type_Creative.getCell());
106107
protected ArrayList<TileInfusionProvider> mTileInfusionProvider = new ArrayList<>();
107108
protected ArrayList<TileNodeEnergized> mNodeEnergized = new ArrayList<>();
@@ -297,7 +298,7 @@ protected float getSpeedBonus() {
297298
return (float) mSpeedBonus;
298299
}
299300

300-
private void countSpeedBonus() {
301+
protected void countSpeedBonus() {
301302
int penalize = 0;
302303
ArrayList<Double> MaxAmount = new ArrayList<>();
303304
AspectList aspectList = new AspectList();
@@ -354,7 +355,7 @@ public static double calculateVariance(List<Double> data) {
354355
return sum / n;
355356
}
356357

357-
private static double calculateMean(List<Double> data) {
358+
protected static double calculateMean(List<Double> data) {
358359
int n = data.size();
359360
double sum = 0.0;
360361

@@ -365,7 +366,7 @@ private static double calculateMean(List<Double> data) {
365366
return sum / n;
366367
}
367368

368-
private Aspect getMaxAspect(@Nonnull AspectList aspectList) {
369+
protected Aspect getMaxAspect(@Nonnull AspectList aspectList) {
369370
Aspect maxAspect = null;
370371
int max = 0;
371372
for (Aspect aspect : aspectList.getAspects()) {
@@ -413,15 +414,15 @@ public void construct(ItemStack stackSize, boolean hintsOnly) {
413414

414415
// region Structure
415416

416-
private static final String STRUCTURE_PIECE_MAIN = "main";
417-
private static final String STRUCTURE_PIECE_MAIN_ERR = "mainErr";
418-
private final int horizontalOffSet = 22;
419-
private final int verticalOffSet = 35;
420-
private final int depthOffSet = 20;
417+
protected static final String STRUCTURE_PIECE_MAIN = "main";
418+
protected static final String STRUCTURE_PIECE_MAIN_ERR = "mainErr";
419+
protected static final int horizontalOffSet = 22;
420+
protected static final int verticalOffSet = 35;
421+
protected static final int depthOffSet = 20;
421422

422423
// spotless:off
423424

424-
private static final String[][] shape = new String[][] {
425+
protected static final String[][] shape = new String[][] {
425426
{ " ", " ",
426427
" ", " ",
427428
" ", " ",
@@ -1642,7 +1643,7 @@ public void construct(ItemStack stackSize, boolean hintsOnly) {
16421643
" ", " ",
16431644
" " } };
16441645

1645-
private static final String[][] shapeErr = new String[][] {
1646+
protected static final String[][] shapeErr = new String[][] {
16461647
{ " ", " ",
16471648
" ", " ",
16481649
" ", " ",
@@ -2879,7 +2880,7 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu
28792880
true);
28802881
}
28812882

2882-
private static IStructureDefinition<GT_TileEntity_IndustrialMagicMatrix> STRUCTURE_DEFINITION = null;
2883+
protected static IStructureDefinition<GT_TileEntity_IndustrialMagicMatrix> STRUCTURE_DEFINITION = null;
28832884

28842885
@Override
28852886
public IStructureDefinition<GT_TileEntity_IndustrialMagicMatrix> getStructureDefinition() {
@@ -2899,15 +2900,15 @@ public IStructureDefinition<GT_TileEntity_IndustrialMagicMatrix> getStructureDef
28992900
withChannel(
29002901
"essentia_cell",
29012902
ofBlocksTiered(
2902-
(a, b) -> a == essentiaCell ? (b + 1) << 3 : -1,
2903+
(a, b) -> a == essentiaCell ? (b + 1) : null,
29032904
ImmutableList.of(
29042905
Pair.of(essentiaCell, 0),
29052906
Pair.of(essentiaCell, 1),
29062907
Pair.of(essentiaCell, 2),
29072908
Pair.of(essentiaCell, 3)),
29082909
-1,
2909-
(x, y) -> x.mParallel = y,
2910-
x -> x.mParallel == 0 ? -1 : x.mParallel)))
2910+
(x, y) -> x.blockTier = y,
2911+
x -> x.blockTier)))
29112912
.addElement('B', ofBlock(GregTechAPI.sBlockCasings8, 8))
29122913
.addElement('C', ofBlock(GregTechAPI.sBlockMetal4, 10))
29132914
.addElement(
@@ -3161,6 +3162,7 @@ public void saveNBTData(NBTTagCompound aNBT) {
31613162
list.appendTag(tag);
31623163
}
31633164
aNBT.setInteger("mParallel", this.mParallel);
3165+
aNBT.setInteger("blockTier", this.blockTier);
31643166
aNBT.setDouble("mSpeedBonus", this.mSpeedBonus);
31653167
aNBT.setTag("Research", list);
31663168
super.saveNBTData(aNBT);
@@ -3181,14 +3183,15 @@ public void loadNBTData(NBTTagCompound aNBT) {
31813183
}
31823184
}
31833185
this.mParallel = aNBT.getInteger("mParallel");
3186+
this.blockTier = aNBT.getInteger("blockTier");
31843187
this.mSpeedBonus = aNBT.getDouble("mSpeedBonus");
31853188
super.loadNBTData(aNBT);
31863189
}
31873190

31883191
@Override
31893192
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
3193+
super.onPreTick(aBaseMetaTileEntity, aTick);
31903194
if (aTick % 100 == 0) {
3191-
super.onPreTick(aBaseMetaTileEntity, aTick);
31923195
if (aBaseMetaTileEntity.isServerSide()) {
31933196
ArrayList<String> list = getResearchForPlayer(getPlayName());
31943197
if ((this.Research == null && list != null)
@@ -3203,10 +3206,16 @@ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
32033206
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
32043207
repairMachine();
32053208
this.mParallel = 0;
3209+
this.blockTier = -1;
32063210
this.mNodeEnergized.clear();
32073211
this.mTileInfusionProvider.clear();
3208-
return checkPiece(STRUCTURE_PIECE_MAIN, horizontalOffSet, verticalOffSet, depthOffSet)
3209-
|| checkPiece(STRUCTURE_PIECE_MAIN_ERR, horizontalOffSet, verticalOffSet, depthOffSet);
3212+
if (checkPiece(STRUCTURE_PIECE_MAIN, horizontalOffSet, verticalOffSet, depthOffSet)
3213+
|| checkPiece(STRUCTURE_PIECE_MAIN_ERR, horizontalOffSet, verticalOffSet, depthOffSet)) {
3214+
if (blockTier > 0) {
3215+
mParallel = blockTier << 3;
3216+
} else return false;
3217+
}
3218+
return false;
32103219
}
32113220

32123221
@Override

0 commit comments

Comments
 (0)