Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up some deprecation usages #3698

Merged
merged 46 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
fec1499
Manual Trafo
serenibyss Dec 23, 2024
62ca18d
Electric Implosion Compressor
serenibyss Dec 23, 2024
90c7e79
Microwave Grinder
serenibyss Dec 23, 2024
62dcb0e
TTMultiblockBase
serenibyss Dec 23, 2024
ded21aa
UCFE
serenibyss Dec 23, 2024
cbf7589
Research Completer
serenibyss Dec 23, 2024
e4fcb11
Windmill
serenibyss Dec 23, 2024
e6f4efc
TFFT
serenibyss Dec 23, 2024
e1204e3
LESU
serenibyss Dec 23, 2024
b7baffd
HTGR
serenibyss Dec 23, 2024
bdeb960
LSC
serenibyss Dec 23, 2024
81f2b0d
Merge branch 'master' into deprecations-cleanup
serenibyss Dec 23, 2024
5c525e3
LINAC
serenibyss Dec 23, 2024
17a1cab
Source Chamber
serenibyss Dec 23, 2024
6d76243
Synchotron
serenibyss Dec 23, 2024
779fd22
Target Chamber
serenibyss Dec 23, 2024
c466bc6
Merge branch 'master' into deprecations-cleanup
Dream-Master Dec 23, 2024
c06de25
THTR
purebluez Dec 23, 2024
08e534d
AAL
serenibyss Dec 24, 2024
c0608bd
EEC
serenibyss Dec 24, 2024
7f11b2f
GTPPMultiBlockBase
serenibyss Dec 24, 2024
1955233
MTEDrillerBase
serenibyss Dec 24, 2024
599639c
MTEEnhancedMultiBlockBase
serenibyss Dec 24, 2024
91a03fc
Bacterial Vat
serenibyss Dec 24, 2024
f9f1af5
CAL
serenibyss Dec 24, 2024
0fe6738
CoAL
serenibyss Dec 24, 2024
0ce0f4b
Naquadah Fuel Refinery
serenibyss Dec 24, 2024
fba42f5
MFE
serenibyss Dec 24, 2024
179bcb5
LCR
serenibyss Dec 24, 2024
9c2e5fd
Large Fluid Extractor
serenibyss Dec 24, 2024
60f4127
MABS
serenibyss Dec 24, 2024
e668cc7
MEBF
serenibyss Dec 24, 2024
d3e90e0
MCR
serenibyss Dec 24, 2024
fd4cd1f
MDT
serenibyss Dec 24, 2024
ea27d48
Mega Oil Cracker
serenibyss Dec 24, 2024
fa8f235
Merge branch 'master' into deprecations-cleanup
Dream-Master Dec 24, 2024
aca53b2
LES (#3702)
CrystieColon3 Dec 24, 2024
f6eab71
Merge branch 'master' into deprecations-cleanup
serenibyss Dec 24, 2024
e8190cf
reviews
serenibyss Dec 26, 2024
b6de096
Merge branch 'master' into deprecations-cleanup
serenibyss Dec 26, 2024
5571123
Merge branch 'master' into deprecations-cleanup
Dream-Master Dec 26, 2024
bcb382d
Merge branch 'master' into deprecations-cleanup
serenibyss Dec 27, 2024
faded0d
Merge branch 'master' into deprecations-cleanup
Dream-Master Dec 31, 2024
fe1f40d
Merge branch 'master' into deprecations-cleanup
serenibyss Jan 3, 2025
40d1a67
Merge branch 'master' into deprecations-cleanup
Dream-Master Jan 4, 2025
c44d4c8
Merge branch 'master' into deprecations-cleanup
Dream-Master Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ public boolean supportsBatchMode() {

@Override
public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer,
float aX, float aY, float aZ) {
float aX, float aY, float aZ, ItemStack aTool) {
if (aPlayer.isSneaking()) {
batchMode = !batchMode;
if (batchMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,23 +588,22 @@ protected boolean supportsSlotAutomation(int aSlot) {

@Override
public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer,
float aX, float aY, float aZ) {
float aX, float aY, float aZ, ItemStack aTool) {
if (!aPlayer.isSneaking()) {
if (mode == 0) return false;
inputSeparation = !inputSeparation;
GTUtility.sendChatToPlayer(
aPlayer,
StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation);
return true;
} else {
batchMode = !batchMode;
if (batchMode) {
GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn"));
} else {
GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff"));
}
return true;
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

import com.google.common.collect.ImmutableList;
import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
Expand Down Expand Up @@ -89,6 +90,7 @@
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import gregtech.api.util.shutdown.ShutDownReason;

public class MTEElectricImplosionCompressor extends MTEExtendedPowerMultiBlockBase<MTEElectricImplosionCompressor>
implements ISurvivalConstructable {
Expand Down Expand Up @@ -198,21 +200,15 @@ public PlaceResult survivalPlaceBlock(MTEElectricImplosionCompressor t, World wo
.build();

public static List<Pair<Block, Integer>> getAllBlockTiers() {
return new ArrayList<>() {

private static final long serialVersionUID = 8171991663102417651L;

{
this.add(Pair.of(GregTechAPI.sBlockMetal5, 2));
if (Mods.Avaritia.isModLoaded()) {
this.add(Pair.of(LudicrousBlocks.resource_block, 1));
}
this.add(Pair.of(GregTechAPI.sBlockMetal9, 4));
this.add(Pair.of(GregTechAPI.sBlockMetal9, 3));
this.add(Pair.of(GregTechAPI.sBlockMetal9, 8));
}

};
ImmutableList.Builder<Pair<Block, Integer>> b = new ImmutableList.Builder<>();
b.add(Pair.of(GregTechAPI.sBlockMetal5, 2));
if (Mods.Avaritia.isModLoaded()) {
b.add(Pair.of(LudicrousBlocks.resource_block, 1));
}
b.add(Pair.of(GregTechAPI.sBlockMetal9, 4));
b.add(Pair.of(GregTechAPI.sBlockMetal9, 3));
b.add(Pair.of(GregTechAPI.sBlockMetal9, 8));
return b.build();
}

public static ITierConverter<Integer> tieredBlockConverter() {
Expand Down Expand Up @@ -374,9 +370,9 @@ public boolean isCorrectMachinePart(ItemStack itemStack) {
}

@Override
public void stopMachine() {
public void stopMachine(@NotNull ShutDownReason reason) {
this.resetPiston(this.mBlockTier);
super.stopMachine();
super.stopMachine(reason);
}

private void resetPiston(int tier) {
Expand Down Expand Up @@ -427,13 +423,12 @@ private void animatePiston(IGregTechTileEntity aBaseMetaTileEntity) {
aBaseMetaTileEntity.getWorld(),
this.chunkCoordinates.get(2).posX,
this.chunkCoordinates.get(2).posY,
this.chunkCoordinates.get(2).posZ,
10);
this.chunkCoordinates.get(2).posZ);
}

@SideOnly(Side.CLIENT)
private void spawnVisualPistonBlocks(World world, int x, int y, int z, int age) {
EICPistonVisualizer pistonVisualizer = new EICPistonVisualizer(world, x, y, z, age);
private void spawnVisualPistonBlocks(World world, int x, int y, int z) {
EICPistonVisualizer pistonVisualizer = new EICPistonVisualizer(world, x, y, z, 10);
Minecraft.getMinecraft().effectRenderer.addEffect(pistonVisualizer);
}

Expand Down Expand Up @@ -536,7 +531,7 @@ public boolean supportsBatchMode() {

@Override
public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer,
float aX, float aY, float aZ) {
float aX, float aY, float aZ, ItemStack aTool) {
if (aPlayer.isSneaking()) {
batchMode = !batchMode;
if (batchMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;

import org.jetbrains.annotations.NotNull;

import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
Expand All @@ -51,10 +53,13 @@
import gregtech.api.metatileentity.implementations.MTEHatchInput;
import gregtech.api.metatileentity.implementations.MTEHatchOutputBus;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTLanguageManager;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.shutdown.ShutDownReasonRegistry;

public class MTEHighTempGasCooledReactor extends MTEEnhancedMultiBlockBase<MTEHighTempGasCooledReactor> {

Expand Down Expand Up @@ -257,23 +262,23 @@ protected boolean filtersFluid() {
}

@Override
public boolean checkRecipe(ItemStack controllerStack) {
public @NotNull CheckRecipeResult checkProcessing() {

if (this.empty) {
if (this.HeliumSupply > 0 || this.fuelsupply > 0) {
this.mEfficiency = 10000;
this.mMaxProgresstime = 100;
return true;
return CheckRecipeResultRegistry.SUCCESSFUL;
}
return false;
return CheckRecipeResultRegistry.NO_RECIPE;
}
if (this.HeliumSupply < MTEHighTempGasCooledReactor.HELIUM_NEEDED || this.fuelsupply < mincapacity)
return false;
return CheckRecipeResultRegistry.NO_RECIPE;

double eff = Math.min(Math.pow((double) this.fuelsupply / (double) mincapacity, 2D), 100D) / 100D
- (this.getIdealStatus() - this.getRepairStatus()) / 10D;

if (eff <= 0) return false;
if (eff <= 0) return CheckRecipeResultRegistry.NO_RECIPE;

int toReduce = MathUtils.floorInt(this.fuelsupply * 0.025D * eff);

Expand All @@ -285,7 +290,7 @@ public boolean checkRecipe(ItemStack controllerStack) {

ItemStack[] toOutput = { new ItemStack(HTGRMaterials.aHTGR_Materials, burnedballs, meta),
new ItemStack(HTGRMaterials.aHTGR_Materials, toReduce, meta + 1) };
if (!this.canOutputAll(toOutput)) return false;
if (!this.canOutputAll(toOutput)) return CheckRecipeResultRegistry.NO_RECIPE;

this.fuelsupply -= originalToReduce;
this.mOutputItems = toOutput;
Expand All @@ -298,7 +303,7 @@ public boolean checkRecipe(ItemStack controllerStack) {
this.mEfficiencyIncrease = 0;
this.mEUt = -powerUsage;
this.mMaxProgresstime = (int) (72000 * (1d - eff / 2d));
return true;
return CheckRecipeResultRegistry.SUCCESSFUL;
}

private int runningtick = 0;
Expand Down Expand Up @@ -344,7 +349,7 @@ public boolean onRunningTick(ItemStack aStack) {
}
// USE DA POWAH
if (!this.drainEnergyInput(-this.mEUt)) {
this.criticalStopMachine();
this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE);
serenibyss marked this conversation as resolved.
Show resolved Hide resolved
return false;
}

Expand All @@ -366,7 +371,7 @@ public boolean onRunningTick(ItemStack aStack) {

this.updateSlots();

if (takecoolant > 0) this.stopMachine();
if (takecoolant > 0) this.stopMachine(ShutDownReasonRegistry.NONE);
serenibyss marked this conversation as resolved.
Show resolved Hide resolved
}

return true;
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/bartworks/common/tileentities/multis/MTELESU.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

import org.jetbrains.annotations.NotNull;

import com.gtnewhorizons.modularui.api.NumberFormatMUI;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
Expand Down Expand Up @@ -59,6 +61,8 @@
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTEMultiBlockBase;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTUtility;

Expand Down Expand Up @@ -140,11 +144,6 @@ public long maxEUOutput() {
return Math.min(Math.max(this.mStorage / Configuration.multiblocks.energyPerCell, 1L), 32768L);
}

@Override
public int rechargerSlotStartIndex() {
return 0;
}

@Override
public int rechargerSlotCount() {
return 1;
Expand Down Expand Up @@ -312,8 +311,8 @@ public boolean isCorrectMachinePart(ItemStack itemStack) {
}

@Override
public boolean checkRecipe(ItemStack itemStack) {
return true;
public @NotNull CheckRecipeResult checkProcessing() {
return CheckRecipeResultRegistry.SUCCESSFUL;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GTValues.V;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW;
Expand All @@ -31,6 +30,8 @@
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

import org.jetbrains.annotations.NotNull;

import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElementNoPlacement;
Expand All @@ -45,9 +46,12 @@
import gregtech.api.metatileentity.implementations.MTEHatchDynamo;
import gregtech.api.metatileentity.implementations.MTEHatchEnergy;
import gregtech.api.metatileentity.implementations.MTETieredMachineBlock;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.shutdown.ShutDownReasonRegistry;

public class MTEManualTrafo extends MTEEnhancedMultiBlockBase<MTEManualTrafo> {

Expand Down Expand Up @@ -158,15 +162,15 @@ public boolean isCorrectMachinePart(ItemStack itemStack) {
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (!this.getBaseMetaTileEntity()
.isAllowedToWork()) this.stopMachine();
.isAllowedToWork()) this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE);
super.onPostTick(aBaseMetaTileEntity, aTick);
}

@Override
public boolean onRunningTick(ItemStack aStack) {
if (!this.getBaseMetaTileEntity()
.isAllowedToWork()) {
this.stopMachine();
this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE);
return false;
}

Expand All @@ -185,25 +189,6 @@ public boolean onRunningTick(ItemStack aStack) {
this.getInputTier() * 2 * this.mEnergyHatches.size() * this.mEfficiency / this.getMaxEfficiency(null));
}

public boolean onRunningTickTabbedMode() {
boolean ret = false;
for (MTEHatchDynamo E : this.mDynamoHatches) {
for (MTEHatchEnergy I : this.mEnergyHatches) {

long vtt = I.getEUVar() >= V[E.mTier] / 2 && E.getEUVar() < E.maxEUStore() ? I.getEUVar() : 0;

if (vtt == 0) continue;

long vtp = E.getEUVar() + vtt;
long avt = Math.min(vtp, E.maxEUStore());
E.setEUVar(avt);
I.setEUVar(I.getEUVar() - vtt);
ret = true;
}
}
return ret;
}

@Override
public long getInputTier() {
if (!this.mEnergyHatches.isEmpty()) return GTUtility.getTier(
Expand All @@ -223,22 +208,33 @@ public long getOutputTier() {
}

@Override
public boolean checkRecipe(ItemStack itemStack) {
public @NotNull CheckRecipeResult checkProcessing() {

if (!this.getBaseMetaTileEntity()
.isAllowedToWork()) {
this.stopMachine();
return false;
this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE);
return CheckRecipeResultRegistry.NONE;
}

ItemStack itemStack = getControllerSlot();
if (itemStack == null || !itemStack.getUnlocalizedName()
.startsWith("gt.integrated_circuit")) this.mode = 0;
else this.mode = (byte) Math.min(3, itemStack.getItemDamage());
this.upstep = this.mode % 2 == 0;
this.mProgresstime = 0;
this.mMaxProgresstime = 1;
this.mEfficiency = Math.max(this.mEfficiency, 100);
return this.upstep ? this.getOutputTier() - this.getInputTier() == this.mTiers
: this.getInputTier() - this.getOutputTier() == this.mTiers;

if (this.upstep) {
if (this.getOutputTier() - this.getInputTier() == this.mTiers) {
return CheckRecipeResultRegistry.SUCCESSFUL;
}
} else {
if (this.getInputTier() - this.getOutputTier() == this.mTiers) {
return CheckRecipeResultRegistry.SUCCESSFUL;
}
}
return CheckRecipeResultRegistry.NO_RECIPE;
}

@Override
Expand Down
Loading
Loading