Skip to content

Commit 1c15477

Browse files
committed
addressing the deprecations
1 parent d3c6865 commit 1c15477

File tree

43 files changed

+137
-143
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+137
-143
lines changed

src/main/java/gregtech/api/capability/IMultiblockController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ public interface IMultiblockController {
44

55
boolean isStructureFormed(String name);
66

7+
default boolean isStructureFormed() {
8+
return isStructureFormed("MAIN");
9+
}
10+
711
default boolean isStructureObstructed() {
812
return false;
913
}

src/main/java/gregtech/api/capability/impl/SteamMultiblockRecipeLogic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void combineSteamTanks() {
7979
public void update() {
8080
// Fixes an annoying GTCE bug in AbstractRecipeLogic
8181
RecipeMapSteamMultiblockController controller = (RecipeMapSteamMultiblockController) metaTileEntity;
82-
if (isActive && !controller.isStructureFormed("MAIN")) {
82+
if (isActive && !controller.isStructureFormed()) {
8383
progressTime = 0;
8484
wasActiveAndNeedsUpdate = true;
8585
}

src/main/java/gregtech/api/metatileentity/multiblock/FuelMultiblockController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected void initializeAbilities() {
4444
protected void addDisplayText(List<ITextComponent> textList) {
4545
MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable;
4646

47-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"))
47+
MultiblockDisplayText.builder(textList, isStructureFormed())
4848
.setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive())
4949
.addEnergyProductionLine(getMaxVoltage(), recipeLogic.getRecipeEUt())
5050
.addFuelNeededLine(recipeLogic.getRecipeFluidInputInfo(), recipeLogic.getPreviousRecipeDuration())
@@ -62,13 +62,13 @@ protected long getMaxVoltage() {
6262

6363
@Override
6464
protected void addWarningText(List<ITextComponent> textList) {
65-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"), false)
65+
MultiblockDisplayText.builder(textList, isStructureFormed(), false)
6666
.addLowDynamoTierLine(isDynamoTierTooLow())
6767
.addMaintenanceProblemLines(getMaintenanceProblems());
6868
}
6969

7070
protected boolean isDynamoTierTooLow() {
71-
if (isStructureFormed("MAIN")) {
71+
if (isStructureFormed()) {
7272
IEnergyContainer energyContainer = recipeMapWorkable.getEnergyContainer();
7373
if (energyContainer != null && energyContainer.getEnergyCapacity() > 0) {
7474
long maxVoltage = Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage());
@@ -144,7 +144,7 @@ protected void addFuelText(List<ITextComponent> textList) {
144144
int fuelCapacity = 0;
145145
FluidStack fuelStack = null;
146146
MultiblockFuelRecipeLogic recipeLogic = (MultiblockFuelRecipeLogic) recipeMapWorkable;
147-
if (isStructureFormed("MAIN") && recipeLogic.getInputFluidStack() != null && getInputFluidInventory() != null) {
147+
if (isStructureFormed() && recipeLogic.getInputFluidStack() != null && getInputFluidInventory() != null) {
148148
fuelStack = recipeLogic.getInputFluidStack().copy();
149149
fuelStack.amount = Integer.MAX_VALUE;
150150
int[] fuelAmount = getTotalFluidAmount(fuelStack, getInputFluidInventory());

src/main/java/gregtech/api/metatileentity/multiblock/IMultiblockPart.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ public interface IMultiblockPart {
77

88
boolean isAttachedToMultiBlock();
99

10-
/**
11-
* Use {@link IMultiblockPart#addToMultiBlock(MultiblockControllerBase, String)} instead!
12-
*/
13-
@Deprecated
1410
default void addToMultiBlock(@NotNull MultiblockControllerBase controllerBase) {
1511
addToMultiBlock(controllerBase, "MAIN");
1612
}
@@ -32,6 +28,10 @@ default void addToMultiBlock(@NotNull MultiblockControllerBase controllerBase) {
3228

3329
boolean canPartShare(MultiblockControllerBase target, String substructureName);
3430

31+
default boolean canPartShare(MultiblockControllerBase target) {
32+
return canPartShare(target, "MAIN");
33+
}
34+
3535
default boolean canPartShare() {
3636
return true;
3737
}

src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void update() {
126126
}
127127
// DummyWorld is the world for the JEI preview. We do not want to update the Multi in this world,
128128
// besides initially forming it in checkStructurePattern
129-
if (isStructureFormed("MAIN") && !(getWorld() instanceof DummyWorld)) {
129+
if (isStructureFormed() && !(getWorld() instanceof DummyWorld)) {
130130
updateFormedValid();
131131
}
132132
}
@@ -172,7 +172,7 @@ public void setUpwardsFacing(EnumFacing upwardsFacing) {
172172
}
173173

174174
public boolean isFlipped() {
175-
return getSubstructure("MAIN").getPatternState().isFlipped();
175+
return getSubstructure().getPatternState().isFlipped();
176176
}
177177

178178
/** <strong>Should not be called outside of structure formation logic!</strong> */
@@ -353,7 +353,7 @@ public static TraceabilityPredicate heatingCoils() {
353353
* INVALID_CACHED,
354354
* so the pattern will not have its cache cleared, and the controller will not attempt to form the pattern again
355355
* unless the cache is invalidated(either through code or through it failing).
356-
* Example: {@code allSameType(GregTechAPI.HEATING_COILS, getSubstructure("MAIN"))}
356+
* Example: {@code allSameType(GregTechAPI.HEATING_COILS, getSubstructure())}
357357
*
358358
* @param info The info, such as GregTechAPI.HEATING_COILS
359359
* @param pattern Pattern, used to get the cache. It will also be used to set the error.
@@ -586,18 +586,10 @@ protected void formStructure(String name) {
586586
writeCustomData(STRUCTURE_FORMED, buf -> buf.writeString(name).writeBoolean(true));
587587
}
588588

589-
/**
590-
* Use {@link MultiblockControllerBase#formStructure(String)} instead!
591-
*/
592-
@Deprecated
593589
protected void formStructure() {
594590
formStructure("MAIN");
595591
}
596592

597-
/**
598-
* Use {@link MultiblockControllerBase#invalidateStructure(String)} instead!
599-
*/
600-
@Deprecated
601593
public void invalidateStructure() {
602594
invalidateStructure("MAIN");
603595
}
@@ -643,6 +635,10 @@ protected void invalidStructureCaches() {
643635
public IBlockPattern getSubstructure(String name) {
644636
return structures.get(name);
645637
}
638+
639+
public IBlockPattern getSubstructure() {
640+
return getSubstructure("MAIN");
641+
}
646642

647643
public String trySubstructure(String name) {
648644
if (structures.get(name) != null) return name;
@@ -726,7 +722,7 @@ public void receiveCustomData(int dataId, PacketBuffer buf) {
726722
String name = buf.readString(Short.MAX_VALUE);
727723
getSubstructure(name).getPatternState().setFormed(buf.readBoolean());
728724

729-
if (!isStructureFormed("MAIN")) {
725+
if (!isStructureFormed()) {
730726
GregTechAPI.soundManager.stopTileSound(getPos());
731727
}
732728
}
@@ -743,12 +739,8 @@ public <T> T getCapability(Capability<T> capability, EnumFacing side) {
743739
return null;
744740
}
745741

746-
/**
747-
* Use {@link MultiblockControllerBase#isStructureFormed(String)} instead!
748-
*/
749-
@Deprecated
750742
public boolean isStructureFormed() {
751-
return isStructureFormed("MAIN");
743+
return isStructureFormed();
752744
}
753745

754746
public boolean isStructureFormed(String name) {
@@ -799,7 +791,7 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac
799791
if (super.onRightClick(playerIn, hand, facing, hitResult))
800792
return true;
801793

802-
if (this.getWorld().isRemote && !this.isStructureFormed("MAIN") && playerIn.isSneaking() &&
794+
if (this.getWorld().isRemote && !this.isStructureFormed() && playerIn.isSneaking() &&
803795
playerIn.getHeldItem(hand).isEmpty()) {
804796
MultiblockPreviewRenderer.renderMultiBlockPreview(this, playerIn, 60000);
805797
return true;

src/main/java/gregtech/api/metatileentity/multiblock/MultiblockWithDisplayBase.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public boolean isMufflerFaceFree() {
269269
if (hasMufflerMechanics() && getAbilities(MultiblockAbility.MUFFLER_HATCH).size() == 0)
270270
return false;
271271

272-
return isStructureFormed("MAIN") && hasMufflerMechanics() &&
272+
return isStructureFormed() && hasMufflerMechanics() &&
273273
getAbilities(MultiblockAbility.MUFFLER_HATCH).get(0).isFrontFaceFree();
274274
}
275275

@@ -302,7 +302,7 @@ protected void setRecoveryItems(ItemStack... recoveryItems) {
302302
* @return whether the current multiblock is active or not
303303
*/
304304
public boolean isActive() {
305-
return isStructureFormed("MAIN");
305+
return isStructureFormed();
306306
}
307307

308308
@Override
@@ -366,7 +366,7 @@ protected TraceabilityPredicate maintenancePredicate() {
366366
* to use translation, use TextComponentTranslation
367367
*/
368368
protected void addDisplayText(List<ITextComponent> textList) {
369-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"));
369+
MultiblockDisplayText.builder(textList, isStructureFormed());
370370
}
371371

372372
/**
@@ -512,7 +512,7 @@ protected Widget getFlexButton(int x, int y, int width, int height) {
512512
* Recommended to only display warnings if the structure is already formed.
513513
*/
514514
protected void addWarningText(List<ITextComponent> textList) {
515-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"), false)
515+
MultiblockDisplayText.builder(textList, isStructureFormed(), false)
516516
.addMaintenanceProblemLines(getMaintenanceProblems());
517517
}
518518

@@ -521,7 +521,7 @@ protected void addWarningText(List<ITextComponent> textList) {
521521
* Prioritized over any warnings provided by {@link MultiblockWithDisplayBase#addWarningText}.
522522
*/
523523
protected void addErrorText(List<ITextComponent> textList) {
524-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"))
524+
MultiblockDisplayText.builder(textList, isStructureFormed())
525525
.addMufflerObstructedLine(hasMufflerMechanics() && !isMufflerFaceFree());
526526
}
527527

src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapMultiblockController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected void updateFormedValid() {
113113

114114
@Override
115115
public boolean isActive() {
116-
return isStructureFormed("MAIN") && recipeMapWorkable.isActive() && recipeMapWorkable.isWorkingEnabled();
116+
return isStructureFormed() && recipeMapWorkable.isActive() && recipeMapWorkable.isWorkingEnabled();
117117
}
118118

119119
protected void initializeAbilities() {
@@ -144,7 +144,7 @@ protected boolean allowSameFluidFillForOutputs() {
144144

145145
@Override
146146
protected void addDisplayText(List<ITextComponent> textList) {
147-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"))
147+
MultiblockDisplayText.builder(textList, isStructureFormed())
148148
.setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive())
149149
.addEnergyUsageLine(recipeMapWorkable.getEnergyContainer())
150150
.addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage()))
@@ -155,7 +155,7 @@ protected void addDisplayText(List<ITextComponent> textList) {
155155

156156
@Override
157157
protected void addWarningText(List<ITextComponent> textList) {
158-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"), false)
158+
MultiblockDisplayText.builder(textList, isStructureFormed(), false)
159159
.addLowPowerLine(recipeMapWorkable.isHasNotEnoughEnergy())
160160
.addMaintenanceProblemLines(getMaintenanceProblems());
161161
}

src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public SoundEvent getSound() {
9090

9191
@Override
9292
protected boolean openGUIOnRightClick() {
93-
return isStructureFormed("MAIN");
93+
return isStructureFormed();
9494
}
9595

9696
@Override

src/main/java/gregtech/api/metatileentity/multiblock/RecipeMapSteamMultiblockController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private void resetTileAbilities() {
101101

102102
@Override
103103
protected void addDisplayText(List<ITextComponent> textList) {
104-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"))
104+
MultiblockDisplayText.builder(textList, isStructureFormed())
105105
.setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive())
106106
.addCustom(tl -> {
107107
// custom steam tank line
@@ -127,9 +127,9 @@ protected void addDisplayText(List<ITextComponent> textList) {
127127

128128
@Override
129129
protected void addWarningText(List<ITextComponent> textList) {
130-
MultiblockDisplayText.builder(textList, isStructureFormed("MAIN"), false)
130+
MultiblockDisplayText.builder(textList, isStructureFormed(), false)
131131
.addCustom(tl -> {
132-
if (isStructureFormed("MAIN") && recipeMapWorkable.isHasNotEnoughEnergy()) {
132+
if (isStructureFormed() && recipeMapWorkable.isHasNotEnoughEnergy()) {
133133
tl.add(TextComponentUtil.translationWithColor(
134134
TextFormatting.YELLOW,
135135
"gregtech.multiblock.steam.low_steam"));

src/main/java/gregtech/api/pattern/GreggyBlockPos.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ public GreggyBlockPos(long l) {
5555
* @param value The value of said coordinate
5656
*/
5757
public GreggyBlockPos set(EnumFacing.Axis axis, int value) {
58-
pos[axis.ordinal()] = value;
59-
return this;
58+
return set(axis.ordinal(), value);
6059
}
6160

6261
/**
@@ -66,8 +65,7 @@ public GreggyBlockPos set(EnumFacing.Axis axis, int value) {
6665
* @param other The pos to take the other axis' value from.
6766
*/
6867
public GreggyBlockPos set(EnumFacing.Axis axis, GreggyBlockPos other) {
69-
pos[axis.ordinal()] = other.pos[axis.ordinal()];
70-
return this;
68+
return set(axis.ordinal(), other.pos[axis.ordinal()]);
7169
}
7270

7371
/**

0 commit comments

Comments
 (0)