Skip to content

Commit

Permalink
Merge branch 'master' into fix_stocking_dupes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Jan 5, 2025
2 parents d3c8136 + fa06129 commit f9592da
Show file tree
Hide file tree
Showing 55 changed files with 416 additions and 486 deletions.
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
api("com.github.GTNewHorizons:ModularUI2:2.2.0-1.7.10:dev")
api("com.github.GTNewHorizons:waila:1.8.2:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-518-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.10-gtnh:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.12-gtnh:dev")
api('com.github.GTNewHorizons:Yamcl:0.6.0:dev')
api("com.github.GTNewHorizons:Postea:1.0.13:dev")

Expand All @@ -60,7 +60,7 @@ dependencies {

compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta28:api') { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:AppleCore:3.3.4:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.41:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.42:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:EnderIO:2.9.2:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:ForestryMC:4.10.1:dev") { transitive = false }
compileOnlyApi("com.github.GTNewHorizons:ProjectRed:4.11.0-GTNH:dev") { transitive = false }
Expand Down
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,14 @@
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;
import gregtech.api.util.shutdown.SimpleShutDownReason;

public class MTEHighTempGasCooledReactor extends MTEEnhancedMultiBlockBase<MTEHighTempGasCooledReactor> {

Expand Down Expand Up @@ -257,23 +263,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 +291,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 +304,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 +350,7 @@ public boolean onRunningTick(ItemStack aStack) {
}
// USE DA POWAH
if (!this.drainEnergyInput(-this.mEUt)) {
this.criticalStopMachine();
this.stopMachine(ShutDownReasonRegistry.POWER_LOSS);
return false;
}

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

this.updateSlots();

if (takecoolant > 0) this.stopMachine();
if (takecoolant > 0) this.stopMachine(SimpleShutDownReason.ofNormal("no_coolant"));
}

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

0 comments on commit f9592da

Please sign in to comment.