From 5d8163cffad0e1e65bcd93779aec38572c90ae78 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 14 Dec 2021 13:21:43 +0000 Subject: Fix Steam Grinder not forming. Fix scrubbers using incorrect slots for turbines and filters. Cleaned up PollutionUtils. --- .../util/minecraft/gregtech/PollutionUtils.java | 174 ++++----------------- .../base/GregtechMeta_MultiBlockBase.java | 44 ++++-- .../base/GregtechMeta_SteamMultiBase.java | 10 +- .../GregtechMetaAtmosphericReconditioner.java | 114 +++++++++----- .../basic/GregtechMetaPollutionCreator.java | 14 +- .../basic/GregtechMetaPollutionDetector.java | 14 +- 6 files changed, 152 insertions(+), 218 deletions(-) (limited to 'src') diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java index 2ae2a9f1de..242a63c712 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java @@ -2,17 +2,13 @@ package gtPlusPlus.core.util.minecraft.gregtech; import static gtPlusPlus.core.lib.CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - import org.apache.commons.lang3.ArrayUtils; import gregtech.GT_Mod; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; -import gregtech.common.GT_Proxy; +import gregtech.common.GT_Pollution; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.base.cell.BaseItemCell; @@ -21,7 +17,6 @@ import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.ItemStack; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidStack; @@ -30,12 +25,6 @@ public class PollutionUtils { private static boolean mIsPollutionEnabled = true; - private static Method mAddPollution; - private static Method mAddPollution2; - - private static Method mGetPollution; - private static Method mGetPollution2; - public static AutoMap mPollutionFluidStacks = new AutoMap(); static { @@ -45,85 +34,37 @@ public class PollutionUtils { mIsPollutionEnabled = false; } } - + public static boolean isPollutionEnabled() { return mIsPollutionEnabled; } - public static boolean mPollution() { - try { - GT_Proxy GT_Pollution = GT_Mod.gregtechproxy; - if (GT_Pollution != null) { - Field mPollution = ReflectionUtils.getField(GT_Pollution.getClass(), "mPollution"); - if (mPollution != null) { - return mPollution.getBoolean(GT_Pollution); - } - } - } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) { - } - return false; + private static boolean mPollution() { + return GT_Mod.gregtechproxy.mPollution; } public static boolean addPollution(IGregTechTileEntity te, int pollutionValue) { - if (mIsPollutionEnabled) - try { - if (te == null) { - return false; - } - if (mAddPollution != null) { - mAddPollution.invoke(null, te, pollutionValue); - } - Class GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", IGregTechTileEntity.class, int.class); - if (addPollution != null) { - mAddPollution = addPollution; - addPollution.invoke(null, te, pollutionValue); - return true; - } - } - } catch (SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } + if (mIsPollutionEnabled) { + GT_Pollution.addPollution(te, pollutionValue); + return true; + } return false; } public static boolean addPollution(IHasWorldObjectAndCoords aTileOfSomeSort, int pollutionValue) { - if (mIsPollutionEnabled) - try { - if (aTileOfSomeSort == null) { - return false; - } - IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; - Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); - return addPollution(c, pollutionValue); - } catch (SecurityException | IllegalArgumentException e) { - } + if (mIsPollutionEnabled) { + IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; + Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); + return addPollution(c, pollutionValue); + } return false; } public static boolean addPollution(Chunk aChunk, int pollutionValue) { - if (mIsPollutionEnabled) - try { - if (aChunk == null) { - return false; - } - if (mAddPollution2 != null) { - mAddPollution2.invoke(null, aChunk, pollutionValue); - return true; - } - Class GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", Chunk.class, int.class); - if (addPollution != null) { - mAddPollution2 = addPollution; - mAddPollution2.invoke(null, aChunk, pollutionValue); - return true; - } - } - } catch (SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } + if (mIsPollutionEnabled) { + GT_Pollution.addPollution(aChunk, pollutionValue); + return true; + } return false; } @@ -155,85 +96,30 @@ public class PollutionUtils { return nullifyPollution(c); } - public static boolean nullifyPollution(Chunk aChunk) { - try { + public static boolean nullifyPollution(Chunk aChunk) { + if (mIsPollutionEnabled) { if (aChunk == null) { return false; } - long getCurrentPollution = getPollution(aChunk); + int getCurrentPollution = getPollution(aChunk); if (getCurrentPollution <= 0) { return false; } else { - if (mAddPollution2 != null) { - mAddPollution2.invoke(null, aChunk, -getCurrentPollution); - return true; - } - else { - Class GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", Chunk.class, int.class); - if (addPollution != null) { - mAddPollution2 = addPollution; - mAddPollution2.invoke(null, aChunk, 0); - return true; - } - } - } + return removePollution(aChunk, getCurrentPollution); } - - } catch (SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } + } return false; } public static int getPollution(IGregTechTileEntity te) { - if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) - try { - if (te == null) { - return 0; - } - if (mGetPollution != null) { - mGetPollution.invoke(null, te); - } - Class GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "getPollution", IGregTechTileEntity.class); - if (addPollution != null) { - mGetPollution = addPollution; - return (int) addPollution.invoke(null, te); - } - } - } catch (SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } - return 0; + return GT_Pollution.getPollution(te); } public static int getPollution(Chunk te) { - if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) - try { - if (te == null) { - return 0; - } - if (mGetPollution2 != null) { - mGetPollution2.invoke(null, te); - } - Class GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution"); - if (GT_Pollution != null) { - Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "getPollution", Chunk.class); - if (addPollution != null) { - mGetPollution2 = addPollution; - return (int) addPollution.invoke(null, te); - } - } - } catch (SecurityException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } - return 0; + return GT_Pollution.getPollution(te); } - + public static boolean setPollutionFluids() { if (mPollutionFluidStacks.isEmpty()) { FluidStack CD, CM, SD; @@ -258,7 +144,7 @@ public class PollutionUtils { else { MaterialGenerator.generate(MISC_MATERIALS.CARBON_DIOXIDE, false, false); } - + if (CM != null) { Logger.INFO("[PollutionCompat] Found carbon monoxide fluid, registering it."); PollutionUtils.mPollutionFluidStacks.put(CM); @@ -276,7 +162,7 @@ public class PollutionUtils { else { MaterialGenerator.generate(MISC_MATERIALS.CARBON_MONOXIDE, false, false); } - + if (SD != null) { Logger.INFO("[PollutionCompat] Found sulfur dioxide fluid, registering it."); PollutionUtils.mPollutionFluidStacks.put(SD); @@ -297,9 +183,9 @@ public class PollutionUtils { return true; } } - - - + + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index d413ce44e4..356f96f7cc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -39,6 +39,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -1681,12 +1682,17 @@ public abstract class GregtechMeta_MultiBlockBase 0) { + this.mHasPollution = true; + } + else { + this.mHasPollution = false; + } boolean isIdle = true; //Get Inventory Item ItemStack stackRotor = this.mInventory[SLOT_ROTOR]; - ItemStack stackFilter = this.mInventory[SLOT_FILTER]; - + ItemStack stackFilter = this.mInventory[SLOT_FILTER]; + //Power Drain long drainEU = maxEUInput() * maxAmperesIn(); if (aBaseMetaTileEntity.isActive() && aBaseMetaTileEntity.getStoredEU() >= drainEU){ @@ -181,34 +186,52 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Only try once/sec. if (!isIdle && aTick % 20L == 0L){ + + for (int i=0;i 0){ + Logger.INFO("Has Pollution? "+mHasPollution+", Current Pollution: "+mCurrentPollution); //Only check every 30s. if (!isIdle && aTick % (20L * 30) == 0L){ - mPollutionEnabled = PollutionUtils.mPollution(); + mPollutionEnabled = PollutionUtils.isPollutionEnabled(); //Clear out pollution if it's disabled, because I am a nice gal. - if (!mPollution()) { + if (!PollutionUtils.isPollutionEnabled()) { PollutionUtils.nullifyPollution(this.getBaseMetaTileEntity()); } } @@ -218,7 +241,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Use a Turbine if(hasRotor(stackRotor) && hasAirFilter(stackFilter)){ - Logger.WARNING("Found Turbine."); + Logger.INFO("Found Turbine."); mBaseEff = (int) ((50.0F + (10.0F * ((GT_MetaGenerated_Tool) stackRotor.getItem()).getToolCombatDamage(stackRotor))) * 100); mOptimalAirFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) stackRotor.getItem()).getToolStats(stackRotor).getSpeedMultiplier() * GT_MetaGenerated_Tool.getPrimaryMaterial(stackRotor).mToolSpeed * 50); @@ -228,8 +251,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Utils.LOG_WARNING("Pollution Cleaner [5]"); //Log Debug information. - Logger.WARNING("mBaseEff[1]:"+mBaseEff); - Logger.WARNING("mOptimalAirFlow[1]:"+mOptimalAirFlow); + Logger.INFO("mBaseEff[1]:"+mBaseEff); + Logger.INFO("mOptimalAirFlow[1]:"+mOptimalAirFlow); //Calculate The Voltage we are running long tVoltage = drainEU; @@ -244,20 +267,20 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //If no sides are free, how will you process the atmosphere? if (mAirSides > 0){ reduction += (((Math.max((tTier-2), 1)*2)*50)*mAirSides); //Was originally *100 - Logger.WARNING("mPollutionReduction[1]:"+reduction); + Logger.INFO("mPollutionReduction[1]:"+reduction); //I stole this code reduction = (MathUtils.safeInt((long)reduction*this.mBaseEff)/100000)*mAirSides*Math.max((tTier-2), 1); - Logger.WARNING("reduction[2]:"+reduction); + Logger.INFO("reduction[2]:"+reduction); reduction = MathUtils.safeInt(((long)reduction/100)*this.mOptimalAirFlow); - Logger.WARNING("reduction[3]:"+reduction); + Logger.INFO("reduction[3]:"+reduction); mPollutionReduction = reduction; //Set a temp to remove variable to aleviate duplicate code. int toRemove = 0; - Logger.WARNING("mCurrentPollution[4]:"+mCurrentPollution); + Logger.INFO("mCurrentPollution[4]:"+mCurrentPollution); if (reduction <= mCurrentPollution){ //Clean some Air. toRemove = reduction; @@ -265,17 +288,17 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { //Makes sure we don't get negative pollution. toRemove = mCurrentPollution; - } - + } + //We are good to clean if (toRemove > 0){ if (damageTurbineRotor() && damageAirFilter()){ Logger.INFO("Removing "+toRemove+" pollution"); removePollution(mSaveRotor ? (toRemove/2) : toRemove); - Logger.WARNING("mNewPollution[4]:"+getCurrentChunkPollution()); + Logger.INFO("mNewPollution[4]:"+getCurrentChunkPollution()); } else { - Logger.WARNING("Could not damage turbine rotor or Air Filter."); + Logger.INFO("Could not damage turbine rotor or Air Filter."); aBaseMetaTileEntity.setActive(false); } } //End of pollution removal block. @@ -370,12 +393,18 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public boolean hasRotor(ItemStack rotorStack){ if(rotorStack != null){ if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) { + //Logger.INFO("Found Basic Turbine Rotor."); return true; } - if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){ + else if (rotorStack.getItem() instanceof GT_MetaGenerated_Tool && rotorStack.getItemDamage() >= 170 && rotorStack.getItemDamage() <= 179){ + //Logger.INFO("Found Turbine Rotor."); return true; } + else { + //Logger.INFO("Found: "+rotorStack.getDisplayName()+":"+rotorStack.getItemDamage()); + } } + //Logger.INFO("Found No Turbine Rotor."); return false; } @@ -411,7 +440,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { //Do Damage ItemAirFilter.setFilterDamage(rotorStack, currentUse+10); - Logger.WARNING("Rotor Damage: "+currentUse); + Logger.INFO("Rotor Damage: "+currentUse); return true; } } @@ -424,23 +453,23 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi double fDam = Math.floor(Math.abs(MathUtils.randFloat(1f, 2f) - MathUtils.randFloat(1f, 2f)) * (1f + 2f - 1f) + 1f); damageValue -= fDam; - //Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); + //Logger.INFO("Trying to do "+damageValue+" damage to the rotor. ["+fDam+"]"); /*Materials M1 = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[this.SLOT_ROTOR]); Materials M2 = GT_MetaGenerated_Tool.getSecondaryMaterial(this.mInventory[this.SLOT_ROTOR]); - Logger.WARNING("Trying to do "+damageValue+" damage to the rotor. [2]");*/ + Logger.INFO("Trying to do "+damageValue+" damage to the rotor. [2]");*/ //Damage Rotor //int rotorDurability = this.mInventory[this.SLOT_ROTOR].getItemDamage(); long rotorDamage = creativeRotor ? 0 : GT_MetaGenerated_Tool.getToolDamage(this.mInventory[this.SLOT_ROTOR]); long rotorDurabilityMax = creativeRotor ? Integer.MAX_VALUE : GT_MetaGenerated_Tool.getToolMaxDamage(this.mInventory[this.SLOT_ROTOR]); long rotorDurability = (rotorDurabilityMax - rotorDamage); - Logger.WARNING("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability); + Logger.INFO("Rotor Damage: "+rotorDamage + " | Max Durability: "+rotorDurabilityMax+" | "+" Remaining Durability: "+rotorDurability); if (rotorDurability >= damageValue){ if (!mSaveRotor){ - Logger.WARNING("Damaging Rotor."); + Logger.INFO("Damaging Rotor."); if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue, 0, null); @@ -454,7 +483,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } } else { - Logger.WARNING("Damaging Rotor."); + Logger.INFO("Damaging Rotor."); if (rotorDurability > 1000){ if (!creativeRotor) GT_ModHandler.damageOrDechargeItem(this.mInventory[this.SLOT_ROTOR], (int) damageValue/2, 0, null); @@ -472,18 +501,18 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } if (rotorDurability <= 0 && !mSaveRotor && !creativeRotor) { - Logger.WARNING("Destroying Rotor."); + Logger.INFO("Destroying Rotor."); this.mInventory[this.SLOT_ROTOR] = null; return false; } else if (rotorDurability <= 0 && mSaveRotor) { - Logger.WARNING("Saving Rotor."); + Logger.INFO("Saving Rotor."); return false; } }else { - Logger.WARNING("Bad Rotor."); + Logger.INFO("Bad Rotor."); return false; } } @@ -494,25 +523,22 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi public int getFreeSpaces(){ int mAir = 0; IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int x = aBaseMetaTileEntity.getXCoord(); - int y = aBaseMetaTileEntity.getYCoord(); - int z = aBaseMetaTileEntity.getZCoord(); - if(aBaseMetaTileEntity.getAirOffset(x+1, y, z)){ + if(aBaseMetaTileEntity.getAirOffset(1, 0, 0)){ mAir++; } - if(aBaseMetaTileEntity.getAirOffset(x-1, y, z)){ + if(aBaseMetaTileEntity.getAirOffset(-1, 0, 0)){ mAir++; } - if(aBaseMetaTileEntity.getAirOffset(x, y, z+1)){ + if(aBaseMetaTileEntity.getAirOffset(0, 0, 1)){ mAir++; } - if(aBaseMetaTileEntity.getAirOffset(x, y, z-1)){ + if(aBaseMetaTileEntity.getAirOffset(0, 0, -1)){ mAir++; } - if(aBaseMetaTileEntity.getAirOffset(x, y+1, z)){ + if(aBaseMetaTileEntity.getAirOffset(0, 1, 0)){ mAir++; } - if(aBaseMetaTileEntity.getAirOffset(x, y-1, z)){ + if(aBaseMetaTileEntity.getAirOffset(0, -1, 0)){ mAir++; } return mAir; @@ -526,8 +552,10 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi if (this.mTier < 7) { int startPollution = getCurrentChunkPollution(); + Logger.INFO("Current Chunk Pollution: "+startPollution); PollutionUtils.removePollution(this.getBaseMetaTileEntity(), toRemove); int after = getCurrentChunkPollution(); + Logger.INFO("Current Chunk Pollution: "+after); return (after 0) { totalRemoved += (startPollution - after); } - Logger.WARNING("Removed "+(startPollution - after)+" pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+after); + Logger.INFO("Removed "+(startPollution - after)+" pollution from chunk "+r.xPosition+", "+r.zPosition+" | "+after); } return totalRemoved > 0 && chunksWithRemoval > 0; } @@ -650,7 +678,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi else { //Do Damage ItemAirFilter.setFilterDamage(filter, currentUse+1); - Logger.WARNING("Filter Damage: "+currentUse); + Logger.INFO("Filter Damage: "+currentUse); return true; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java index 5f55e080ad..65217f9e53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionCreator.java @@ -1,24 +1,20 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { @@ -189,7 +185,7 @@ public class GregtechMetaPollutionCreator extends GregtechMetaTileEntity { public int pollutionMultiplier = 1; private void showPollution(final World worldIn, final EntityPlayer playerIn){ - if(!PollutionUtils.mPollution()){ + if(!PollutionUtils.isPollutionEnabled()){ PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled."); } else { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java index 10319f2269..69a4f96708 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java @@ -1,25 +1,21 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity { @@ -190,7 +186,7 @@ public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity { } private void showPollution(final World worldIn, final EntityPlayer playerIn){ - if(!PollutionUtils.mPollution()){ + if(!PollutionUtils.isPollutionEnabled()){ PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled."); } else { -- cgit From b404dd06675bb5031c4c3095f950a83fb7d40e43 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 14 Dec 2021 14:40:37 +0000 Subject: Fix PSS not forming correctly. Thanks to @Glease. Fix ItemBasicScrubberTurbine not working in Scrubbers. Improved scrubber handling slightly. --- .../item/general/ItemBasicScrubberTurbine.java | 12 +- .../gtPlusPlus/core/recipe/RECIPES_General.java | 6 + .../api/gui/basic/GUI_PollutionCleaner.java | 2 +- .../GregtechMetaAtmosphericReconditioner.java | 106 ++++++++--- ...chMetaTileEntity_PowerSubStationController.java | 197 +++++++++++++++------ src/resources/assets/miscutils/lang/en_US.lang | 1 + 6 files changed, 234 insertions(+), 90 deletions(-) (limited to 'src') diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java b/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java index bd8159eb01..2b7b98640e 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java @@ -42,7 +42,7 @@ public class ItemBasicScrubberTurbine extends Item { @Override public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 2; i ++) { + for (int i = 0; i < 3; i ++) { list.add(new ItemStack(item, 1, i)); } } @@ -69,6 +69,9 @@ public class ItemBasicScrubberTurbine extends Item { if (meta == 1){ HEX_OxFFFFFF = Utils.rgbtoHexValue(255,128,0); } + if (meta == 2){ + HEX_OxFFFFFF = Utils.rgbtoHexValue(128,128,128); + } return HEX_OxFFFFFF; } @@ -111,10 +114,13 @@ public class ItemBasicScrubberTurbine extends Item { if (aStack != null) { int aMeta = aStack.getItemDamage(); if (aMeta == 0) { - return 2500; + return 2000; } if (aMeta == 1) { - return 5000; + return 4000; + } + if (aMeta == 2) { + return 6000; } } return 0; diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java index 08d8dda039..1c95467770 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -194,6 +194,12 @@ public class RECIPES_General { "stickBronze", "plateBronze", CI.craftingToolHammer_Hard, ItemUtils.simpleMetaStack(ModItems.itemBasicTurbine, 1, 1) ); + RecipeUtils.addShapedRecipe( + CI.craftingToolFile, "plateSteel", "stickSteel", + "plateSteel", "ringSteel", "plateSteel", + "stickSteel", "plateSteel", CI.craftingToolHammer_Hard, + ItemUtils.simpleMetaStack(ModItems.itemBasicTurbine, 2, 1) + ); } if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java index 7a9417eeb6..3b96731f00 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java @@ -47,7 +47,7 @@ public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { //Do Dumb shit CONTAINER_PollutionCleaner aContainerCast = (CONTAINER_PollutionCleaner) this.mContainer; mReduction = aContainerCast.mReduction; - list.add("Reduction: "+mReduction); + list.add("Reduction: "+mReduction+"/s"); } } if (!list.isEmpty()) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index a4b4d902ed..23a76fb582 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -48,7 +48,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi protected boolean mSaveRotor = false; public GregtechMetaAtmosphericReconditioner(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 2, "Making sure you don't live in Gwalior - Uses 2A", 2, 0, "Recycler.png", "", + super(aID, aName, aNameRegional, aTier, 2, "Making sure you don't live in Gwalior - Uses 2A", 3, 0, "Recycler.png", "", new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), @@ -147,12 +147,6 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Get Current Pollution Amount. int mCurrentPollution = getCurrentChunkPollution(); - if (mCurrentPollution > 0) { - this.mHasPollution = true; - } - else { - this.mHasPollution = false; - } boolean isIdle = true; //Get Inventory Item @@ -187,6 +181,15 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Only try once/sec. if (!isIdle && aTick % 20L == 0L){ + + + for (int i=0;i 0 && this.mOptimalAirFlow > 0){ @@ -281,6 +284,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi int toRemove = 0; Logger.INFO("mCurrentPollution[4]:"+mCurrentPollution); + Logger.INFO("mCurrentPollution[5]:"+reduction); if (reduction <= mCurrentPollution){ //Clean some Air. toRemove = reduction; @@ -289,7 +293,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Makes sure we don't get negative pollution. toRemove = mCurrentPollution; } - + Logger.INFO("mCurrentPollution[6]:"+toRemove); + //We are good to clean if (toRemove > 0){ if (damageTurbineRotor() && damageAirFilter()){ @@ -416,33 +421,43 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi if (rotorStack == null) { return false; } - else { - if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { - Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); - Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); - if (t1 == Materials._NULL && t2 == Materials._NULL){ - creativeRotor = true; - } - } - } - - if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) { + else if (rotorStack.getItem() instanceof ItemBasicScrubberTurbine) { long currentUse = ItemBasicScrubberTurbine.getFilterDamage(rotorStack); //Remove broken Filter - if (rotorStack.getItemDamage() == 0 && currentUse >= 2500-10){ + if (rotorStack.getItemDamage() == 0 && currentUse >= 2000-10){ + Logger.INFO("Depleting ItemBasicScrubberTurbine T1"); this.mInventory[this.SLOT_FILTER] = null; return false; } - else if (rotorStack.getItemDamage() == 1 && currentUse >= 5000-10){ + else if (rotorStack.getItemDamage() == 1 && currentUse >= 4000-10){ + Logger.INFO("Depleting ItemBasicScrubberTurbine T2"); + this.mInventory[this.SLOT_FILTER] = null; + return false; + } + else if (rotorStack.getItemDamage() == 2 && currentUse >= 6000-10){ + Logger.INFO("Depleting ItemBasicScrubberTurbine T3"); this.mInventory[this.SLOT_FILTER] = null; return false; } else { //Do Damage - ItemAirFilter.setFilterDamage(rotorStack, currentUse+10); + Logger.INFO("Damaging ItemBasicScrubberTurbine"); + ItemBasicScrubberTurbine.setFilterDamage(rotorStack, currentUse+10); Logger.INFO("Rotor Damage: "+currentUse); return true; } + } + else if(rotorStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(rotorStack); + Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(rotorStack); + if (t1 == Materials._NULL && t2 == Materials._NULL){ + Logger.INFO("Found creative rotor."); + creativeRotor = true; + } + } + else { + Logger.INFO("Bad item in rotor slot."); + return false; } if(mInventory[SLOT_ROTOR].getItem() instanceof GT_MetaGenerated_Tool_01 && @@ -516,7 +531,9 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi return false; } } - catch (Throwable t){} + catch (Throwable t){ + t.printStackTrace(); + } return false; } @@ -698,14 +715,14 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - if (aIndex == 5) { + if (aIndex == SLOT_FILTER) { if (aStack.getItem() instanceof ItemAirFilter) { Logger.INFO("Inserting Air Filter into "+aIndex); return true; } } - if (aIndex == 4) { - if (this.mInventory[6] != null) { + if (aIndex == SLOT_ROTOR) { + if (this.mInventory[7] != null) { Logger.INFO("Found conveyor, can automate turbines. Inserting into "+aIndex); if (aStack.getItem() instanceof ItemBasicScrubberTurbine) { return true; @@ -814,4 +831,35 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi super.setItemNBT(aNBT); } + private static ItemStack[] sGregTurbines; + + public static ItemStack getTieredTurbine(int aTier) { + if (sGregTurbines == null) { + sGregTurbines = new ItemStack[3]; + sGregTurbines[0] = GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(GT_MetaGenerated_Tool_01.TURBINE_SMALL, 1, Materials.Iron, Materials.Iron, null); + sGregTurbines[1] = GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(GT_MetaGenerated_Tool_01.TURBINE_SMALL, 1, Materials.Bronze, Materials.Bronze, null); + sGregTurbines[2] = GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(GT_MetaGenerated_Tool_01.TURBINE_SMALL, 1, Materials.Steel, Materials.Steel, null); + } + else { + return sGregTurbines[aTier]; + } + + return null; + } + + public int getBaseEfficiency(ItemStack aStackRotor) { + if (aStackRotor.getItem() instanceof ItemBasicScrubberTurbine) { + return getBaseEfficiency(getTieredTurbine(aStackRotor.getItemDamage())); + } + return (int) ((50.0F + (10.0F * ((GT_MetaGenerated_Tool) aStackRotor.getItem()).getToolCombatDamage(aStackRotor))) * 100); + } + + public int getOptimalAirFlow(ItemStack aStackRotor) { + if (aStackRotor.getItem() instanceof ItemBasicScrubberTurbine) { + return getOptimalAirFlow(getTieredTurbine(aStackRotor.getItemDamage())); + } + return (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) aStackRotor.getItem()).getToolStats(aStackRotor).getSpeedMultiplier() + * GT_MetaGenerated_Tool.getPrimaryMaterial(aStackRotor).mToolSpeed * 50); + } + } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index a90c962cae..78adb094ed 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -5,6 +5,9 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdderOptional; + +import java.util.function.Predicate; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -20,6 +23,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -46,6 +50,12 @@ import net.minecraft.world.World; public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMeta_MultiBlockBase { + private static enum TopState { + MayBeTop, + Top, + NotTop + } + protected long mAverageEuUsage = 0; protected long mTotalEnergyAdded = 0; protected long mTotalEnergyConsumed = 0; @@ -57,7 +67,8 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe private int mCasing; private int[] cellCount = new int[6]; - private IStructureDefinition STRUCTURE_DEFINITION = null; + private TopState topState = TopState.MayBeTop; + private static IStructureDefinition STRUCTURE_DEFINITION = null; public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -76,19 +87,19 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType(getMachineType()) - .addInfo("[BUG] GUI does not work until structure is assembled correctly. (Do Not Report issue)") - .addInfo("Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches") - .addInfo("Does not require maintenance") - .addInfo("Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "") - .addInfo("Hatches can be placed nearly anywhere") - .addInfo("HV Energy/Dynamo Hatches are the lowest tier you can use") - .addInfo("Supports voltages >= UHV using MAX tier components.") - .addSeparator() - .addController("Bottom Center") - .addCasingInfo("Sub-Station External Casings", 10) - .addDynamoHatch("Any Casing", 1) - .addEnergyHatch("Any Casing", 1) - .toolTipFinisher(CORE.GT_Tooltip_Builder); + .addInfo("[BUG] GUI does not work until structure is assembled correctly. (Do Not Report issue)") + .addInfo("Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches") + .addInfo("Does not require maintenance") + .addInfo("Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "") + .addInfo("Hatches can be placed nearly anywhere") + .addInfo("HV Energy/Dynamo Hatches are the lowest tier you can use") + .addInfo("Supports voltages >= UHV using MAX tier components.") + .addSeparator() + .addController("Bottom Center") + .addCasingInfo("Sub-Station External Casings", 10) + .addDynamoHatch("Any Casing", 1) + .addEnergyHatch("Any Casing", 1) + .toolTipFinisher(CORE.GT_Tooltip_Builder); return tt; } @@ -202,62 +213,100 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe if (STRUCTURE_DEFINITION == null) { STRUCTURE_DEFINITION = StructureDefinition.builder() .addShape(mName + "bottom", transpose(new String[][]{ - {"CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"} + {"CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"} + })) + .addShape(mName + "layer", transpose(new String[][]{ + {"CCCCC", "CIIIC", "CIIIC", "CIIIC", "CCCCC"} })) .addShape(mName + "mid", transpose(new String[][]{ - {"CCCCC", "CHHHC", "CHHHC", "CHHHC", "CCCCC"} + {"CCCCC", "CHHHC", "CHHHC", "CHHHC", "CCCCC"} })) .addShape(mName + "top", transpose(new String[][]{ - {"CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"} + {"CCCCC", "CCCCC", "CCCCC", "CCCCC", "CCCCC"} })) .addElement( 'C', ofChain( ofHatchAdder( GregtechMetaTileEntity_PowerSubStationController::addPowerSubStationList, TAE.GTPP_INDEX(24), 1 - ), + ), onElementPass( x -> ++x.mCasing, ofBlock( ModBlocks.blockCasings2Misc, 8 + ) ) ) ) - ) .addElement( - 'H', + 'I', ofChain( - onElementPass( - x -> ++x.cellCount[0], - ofCell(4) - ), - onElementPass( - x -> ++x.cellCount[1], - ofCell(5) - ), - onElementPass( - x -> ++x.cellCount[2], - ofCell(6) - ), - onElementPass( - x -> ++x.cellCount[3], - ofCell(7) - ), - onElementPass( - x -> ++x.cellCount[4], - ofCell(8) - ), - onElementPass( - x -> ++x.cellCount[5], - ofCell(9) + onlyIf( + x -> x.topState != TopState.NotTop, + onElementPass( + x -> x.topState = TopState.Top, + ofHatchAdderOptional(GregtechMetaTileEntity_PowerSubStationController::addPowerSubStationList, TAE.GTPP_INDEX(24), 1, ModBlocks.blockCasings2Misc, 8) + ) + ), + onlyIf( + x -> x.topState != TopState.Top, + onElementPass( + x -> x.topState = TopState.NotTop, + ofChain( + onElementPass( + x -> ++x.cellCount[0], + ofCell(4) + ), + onElementPass( + x -> ++x.cellCount[1], + ofCell(5) + ), + onElementPass( + x -> ++x.cellCount[2], + ofCell(6) + ), + onElementPass( + x -> ++x.cellCount[3], + ofCell(7) + ), + onElementPass( + x -> ++x.cellCount[4], + ofCell(8) + ), + onElementPass( + x -> ++x.cellCount[5], + ofCell(9) + ) + ) + ) + ) ) ) - ) + .addElement('H', ofCell(4)) .build(); } return STRUCTURE_DEFINITION; } + public static IStructureElement onlyIf(Predicate predicate, IStructureElement downstream) { + return new IStructureElement() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + return predicate.test(t) && downstream.check(t, world, x, y, z); + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + return predicate.test(t) && downstream.spawnHint(t, world, x, y, z, trigger); + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return predicate.test(t) && downstream.placeBlock(t, world, x, y, z, trigger); + } + }; + } + public static IStructureElement ofCell(int aIndex) { return new IStructureElement() { @Override @@ -289,45 +338,74 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe @Override public void construct(ItemStack stackSize, boolean hintsOnly) { int layer = Math.min(stackSize.stackSize + 3, 18); + log("Layer: "+layer); + log("Building 0"); buildPiece(mName + "bottom" , stackSize, hintsOnly, 2, 0, 0); + log("Built 0"); for (int i = 1; i < layer - 1; i++) { + log("Building "+i); buildPiece(mName + "mid", stackSize, hintsOnly, 2, i, 0); + log("Built "+i); } + log("Building "+(layer - 1)); buildPiece(mName + "top", stackSize, hintsOnly, 2, layer - 1, 0); + log("Built "+(layer - 1)); } @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0; + mEnergyHatches.clear(); + mDynamoHatches.clear(); + mTecTechEnergyHatches.clear(); + mTecTechDynamoHatches.clear(); mAllEnergyHatches.clear(); mAllDynamoHatches.clear(); for (int i = 0; i < 6; i++) { cellCount[i] = 0; } - if (!checkPiece(mName + "bottom", 2, 0, 0)) + log("Checking 0"); + if (!checkPiece(mName + "bottom", 2, 0, 0)) { + log("Failed on Layer 0"); return false; + } + log("Pass 0"); int layer = 1; - while (checkPiece(mName + "mid", 2, layer, 0)) { + topState = TopState.MayBeTop; + while (true) { + if (!checkPiece(mName + "layer", 2, layer, 0)) + return false; layer ++; + if (topState == TopState.Top) + break; // top found, break out + topState = TopState.MayBeTop; + if (layer > 18) + return false; // too many layers } - if (layer > 19 || !checkPiece(mName + "top", 2, layer, 0)) - return false; int level = 0; for (int i = 0; i < 6; i++) { if (cellCount[i] != 0) { - if (level == 0) level = i + 4; - else return false; + if (level == 0) { + level = i + 4; + } + else { + return false; + } } } int tier = getMaxHatchTier(level); long volSum = 0; for (GT_MetaTileEntity_Hatch hatch : mAllDynamoHatches) { - if (hatch.mTier > tier || hatch.mTier < 3) return false; - volSum += (8 << (hatch.mTier * 2)); + if (hatch.mTier > tier || hatch.mTier < 3) { + return false; + } + volSum += (8L << (hatch.mTier * 2)); } for (GT_MetaTileEntity_Hatch hatch : mAllEnergyHatches) { - if (hatch.mTier > tier || hatch.mTier < 3) return false; - volSum += (8 << (hatch.mTier * 2)); + if (hatch.mTier > tier || hatch.mTier < 3) { + return false; + } + volSum += (8L << (hatch.mTier * 2)); } mBatteryCapacity = getCapacityFromCellTier(level) * cellCount[level - 4]; if (mAllEnergyHatches.size() + mAllDynamoHatches.size() > 0) { @@ -345,9 +423,14 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo) { return addToMachineList(aTileEntity, aBaseCasingIndex); - } if (LoadedMods.TecTech) { + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + else if (LoadedMods.TecTech) { if (isThisHatchMultiDynamo(aMetaTileEntity)) { return addToMachineList(aTileEntity, aBaseCasingIndex); } else if (isThisHatchMultiEnergy(aMetaTileEntity)) { @@ -406,7 +489,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe @Override public void loadNBTData(NBTTagCompound aNBT) { - + // Best not to get a long if the Tag Map is holding an int if (aNBT.hasKey("mAverageEuUsage")) { this.mAverageEuUsage = aNBT.getLong("mAverageEuUsage"); diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index c70d102235..7a021cbc26 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -3235,6 +3235,7 @@ tile.Botmium Frame Box.name=Botmium Frame Box item.itemBasicTurbine.name=Basic Turbine item.itemBasicTurbine_0.name=Basic Iron Turbine item.itemBasicTurbine_1.name=Basic Bronze Turbine +item.itemBasicTurbine_2.name=Basic Steel Turbine interaction.voidexcess.enabled=Void Excess Enabled interaction.voidexcess.disabled=Void Excess Disabled -- cgit From 58b0e210013c95ed5ea4e1eb0117937f46c8e107 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 14 Dec 2021 14:42:45 +0000 Subject: Nerf single block scrubbed by 50%. --- .../machines/basic/GregtechMetaAtmosphericReconditioner.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index 23a76fb582..33ffd1f118 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -293,6 +293,8 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi //Makes sure we don't get negative pollution. toRemove = mCurrentPollution; } + + toRemove = toRemove/2; Logger.INFO("mCurrentPollution[6]:"+toRemove); //We are good to clean -- cgit From 9e2108e939fb78c002fc0618b2200427dc88914f Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 14 Dec 2021 15:09:44 +0000 Subject: Changed IsaMill textures slightly. --- .../common/blocks/GregtechMetaCasingBlocks5.java | 4 ++-- .../blocks/textures/TexturesGrinderMultiblock.java | 2 +- .../TileEntities/MACHINE_CASING_GRINDING_FACTORY.png | Bin 671 -> 677 bytes .../blocks/TileEntities/MACHINE_CASING_PIPE_T1.png | Bin 598 -> 656 bytes 4 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java index c594ee0e5d..61c71ba552 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java @@ -60,9 +60,9 @@ extends GregtechMetaCasingBlocksAbstract { if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { case 0: - return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon(); - case 1: return TexturesGtBlock.TEXTURE_PIPE_GRINDING_MILL.getIcon(); + case 1: + return TexturesGtBlock.TEXTURE_CASING_GRINDING_MILL.getIcon(); case 2: return TexturesGtBlock.TEXTURE_GEARBOX_GRINDING_MILL.getIcon(); case 3: diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java index 962f981d3b..b254fdbc1e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGrinderMultiblock.java @@ -85,7 +85,7 @@ public class TexturesGrinderMultiblock { public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks5 ii) { final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); - if (tMeta != 0) { + if (tMeta != 1) { return GregtechMetaCasingBlocks5.getStaticIcon(aSide, tMeta); } int tInvertLeftRightMod = aSide % 2 * 2 - 1; diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png index d8677eda87..b807fc0465 100644 Binary files a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png and b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_GRINDING_FACTORY.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png index c0065f8379..1b942edfc9 100644 Binary files a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png and b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_PIPE_T1.png differ -- cgit From 795a1394a6de7d19b2d0523896cf7ee8ee4523c8 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 14 Dec 2021 17:43:08 +0000 Subject: Adjusted REE outputs. Fixed ABS not accepting output bus. --- src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java | 4 ++-- .../multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java index 0b93e7dd9c..19e8499f02 100644 --- a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java @@ -134,7 +134,7 @@ public final class MISC_MATERIALS { new MaterialStack(ORES.GREENOCKITE, 1), new MaterialStack(ORES.LANTHANITE_CE, 1), new MaterialStack(ORES.AGARDITE_CD, 1), - new MaterialStack(ORES.XENOTIME, 1), + new MaterialStack(ORES.YTTRIALITE, 1), new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.NetherQuartz), 1), new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Galena), 1), new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Chalcopyrite), 1), @@ -182,7 +182,7 @@ public final class MISC_MATERIALS { new MaterialStack(ORES.LAUTARITE, 1), new MaterialStack(ORES.DEMICHELEITE_BR, 1), new MaterialStack(ORES.ALBURNITE, 1), - new MaterialStack(ORES.KASHINITE, 1), + new MaterialStack(ORES.SAMARSKITE_Y, 1), new MaterialStack(ORES.AGARDITE_LA, 1), }); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index c84c5e162e..323efa2193 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -148,6 +148,8 @@ extends GregtechMeta_MultiBlockBase { return addToMachineList(aTileEntity, aBaseCasingIndex); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) { + return addToMachineList(aTileEntity, aBaseCasingIndex); } } return false; -- cgit From 2a7a8a3dcad8b14c4efa53cffc62fd71c36f7ce3 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 14 Dec 2021 23:11:43 +0000 Subject: Fix broken ICO structure check. --- .../multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java index 21caf135b1..63dd3d62dc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -81,7 +81,7 @@ extends GregtechMeta_MultiBlockBase { if (STRUCTURE_DEFINITION == null) { STRUCTURE_DEFINITION = StructureDefinition.builder() .addShape(mName, transpose(new String[][]{ - {"CCC", "C-C", "CCC"}, + {"CCC", "CCC", "CCC"}, {"HHH", "H-H", "HHH"}, {"C~C", "CCC", "CCC"}, })) -- cgit