From 676b4ef85886d0d9f037e6fbc7d3bb5b2f729159 Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Tue, 21 May 2024 18:07:54 +0100 Subject: [PATCH 1/2] fix pollution amount --- .../base/generators/GregtechRocketFuelGeneratorBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index 6d898337ac..aebb5bf22b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -279,7 +279,7 @@ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); - PollutionUtils.addPollution(getBaseMetaTileEntity(), 10 * getPollution()); + PollutionUtils.addPollution(getBaseMetaTileEntity(), getPollution() / 2); } } } From 854ab1f786f8084814111384ea8bfe97383bbdec Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Tue, 21 May 2024 18:13:12 +0100 Subject: [PATCH 2/2] slight code cleanup --- .../GregtechRocketFuelGeneratorBase.java | 49 ++----------------- 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index aebb5bf22b..2b2766399d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -27,7 +27,6 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_BasicTank implements RecipeMapWorkable { - private boolean useFuel = false; protected int pollMin, pollMax; public GregtechRocketFuelGeneratorBase(final int aID, final String aName, final String aNameRegional, @@ -210,36 +209,6 @@ public boolean isFluidInputAllowed(final FluidStack aFluid) { @Override public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - // super.onPostTick(aBaseMetaTileEntity, aTick); - - /* - * if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) { int - * tFuelValue; if (this.mFluid == null) { if (aBaseMetaTileEntity.getUniversalEnergyStored() < - * this.maxEUOutput() + this.getMinimumStoredEU()) { this.mInventory[this.getStackDisplaySlot()] = null; } else - * { if (this.mInventory[this.getStackDisplaySlot()] == null) { this.mInventory[this.getStackDisplaySlot()] = - * new ItemStack(Blocks.fire, 1); } - * this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " + - * (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); } } else { tFuelValue - * = this.getFuelValue(this.mFluid); int tConsumed = this.consumedFluidPerOperation(this.mFluid); if (tFuelValue - * > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) { long tFluidAmountToUse = Math.min((long) - * (this.mFluid.amount / tConsumed), (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / - * (long) tFuelValue); if (tFluidAmountToUse > 0L && aBaseMetaTileEntity - * .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { - * PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); this.mFluid.amount = - * (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed); } } } if - * (this.mInventory[this.getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < - * this.maxEUOutput() * 20L + this.getMinimumStoredEU() && - * GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) { tFuelValue = - * this.getFuelValue(this.mInventory[this.getInputSlot()]); if (tFuelValue > 0) { ItemStack tEmptyContainer = - * this.getEmptyContainer(this.mInventory[this.getInputSlot()]); if - * (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { - * aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true); - * aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); - * PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); } } } } if - * (aBaseMetaTileEntity.isServerSide()) { aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && - * aBaseMetaTileEntity .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); } - */ - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) { if (this.mFluid == null) { if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) { @@ -311,22 +280,14 @@ public int getFuelValue(final FluidStack aLiquid) { } FluidStack tLiquid; final Collection tRecipeList = this.getRecipeMap().getAllRecipes(); - if (tRecipeList != null) { - // Logger.INFO("Step A"); - for (final GT_Recipe tFuel : tRecipeList) { - // Logger.INFO("Step B"); - if ((tLiquid = tFuel.mFluidInputs[0]) != null) { - // Logger.INFO("Step C"); - if (aLiquid.isFluidEqual(tLiquid)) { - // Logger.INFO("Found some fuel?"); - int aperOp = this.consumedFluidPerOperation(tLiquid); - int aConsume = (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * aperOp) / 100); - return aConsume; - } + for (final GT_Recipe tFuel : tRecipeList) { + if ((tLiquid = tFuel.mFluidInputs[0]) != null) { + if (aLiquid.isFluidEqual(tLiquid)) { + int aperOp = this.consumedFluidPerOperation(tLiquid); + return (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * aperOp) / 100); } } } - // Logger.INFO("No Fuel Value | Valid? "+(aLiquid != null)); return 0; }