diff options
author | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-01 14:34:14 +0100 |
---|---|---|
committer | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-01 14:34:14 +0100 |
commit | 8e45b04722ee129ff412d8329b93d35eb8744c1f (patch) | |
tree | 5ed344f739e2349854b6acb5d451f00d8ca35319 /src | |
parent | 899aa570f096e2850e35627950f9f67ccfe8b186 (diff) | |
parent | 5fc226f1385e13afbf3406f4d3283638fc7b8a70 (diff) | |
download | GT5-Unofficial-8e45b04722ee129ff412d8329b93d35eb8744c1f.tar.gz GT5-Unofficial-8e45b04722ee129ff412d8329b93d35eb8744c1f.tar.bz2 GT5-Unofficial-8e45b04722ee129ff412d8329b93d35eb8744c1f.zip |
Merge remote-tracking branch 'origin/experimental' into unify-build-script
# Conflicts:
# .github/workflows/gradle.yml
# build.gradle
# build.properties
Diffstat (limited to 'src')
65 files changed, 712 insertions, 265 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 27bd346ecd..9ad5b3634f 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -115,7 +115,7 @@ import static gregtech.api.enums.GT_Values.MOD_ID_FR; " after:TConstruct;" + " after:Translocator;") public class GT_Mod implements IGT_Mod { - public static final int VERSION = 509, SUBVERSION = 39; + public static final int VERSION = 509, SUBVERSION = 40; public static final int TOTAL_VERSION = calculateTotalGTVersion(VERSION, SUBVERSION); public static final int REQUIRED_IC2 = 624; @Mod.Instance("gregtech") @@ -201,7 +201,7 @@ public class GT_Mod implements IGT_Mod { GregTech_API.sSpecialFile = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "Other.cfg"))); GregTech_API.sOPStuff = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "OverpoweredStuff.cfg"))); - GregTech_API.sClientDataFile = new GT_Config(new Configuration(new File(aEvent.getModConfigurationDirectory().getParentFile(), "GregTech.cfg"))); + GregTech_API.sClientDataFile = new GT_Config(new Configuration(new File(new File(aEvent.getModConfigurationDirectory(), "GregTech"), "Client.cfg"))); GregTech_API.mIC2Classic = Loader.isModLoaded("IC2-Classic-Spmod"); GregTech_API.mGTPlusPlus = Loader.isModLoaded("miscutils"); GregTech_API.mTranslocator = Loader.isModLoaded("Translocator"); @@ -340,6 +340,8 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true); gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile.get("render", "RenderFlippedMachinesFlipped", true); gregtechproxy.mRenderIndicatorsOnHatch = GregTech_API.sClientDataFile.get("render", "RenderIndicatorsOnHatch", true); + gregtechproxy.mRenderDirtParticles = GregTech_API.sClientDataFile.get("render", "RenderDirtParticles", true); + gregtechproxy.mRenderPollutionFog = GregTech_API.sClientDataFile.get("render", "RenderPollutionFog", true); gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get(aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3).getInt(3); gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get(aTextGeneral, "SkeletonsShootGTArrows", 16).getInt(16); @@ -375,12 +377,37 @@ public class GT_Mod implements IGT_Mod { gregtechproxy.mTEMachineRecipes = tMainConfig.get("general", "TEMachineRecipes", false).getBoolean(false); gregtechproxy.mEnableAllMaterials = tMainConfig.get("general", "EnableAllMaterials", false).getBoolean(false); gregtechproxy.mEnableAllComponents = tMainConfig.get("general", "EnableAllComponents", false).getBoolean(false); - gregtechproxy.mPollution = tMainConfig.get("Pollution", "EnablePollution", true).getBoolean(true); - gregtechproxy.mPollutionSmogLimit = tMainConfig.get("Pollution", "SmogLimit", 500000).getInt(500000); - gregtechproxy.mPollutionPoisonLimit = tMainConfig.get("Pollution", "PoisonLimit", 750000).getInt(750000); - gregtechproxy.mPollutionVegetationLimit = tMainConfig.get("Pollution", "VegetationLimit", 1000000).getInt(1000000); - gregtechproxy.mPollutionSourRainLimit = tMainConfig.get("Pollution", "SourRainLimit", 2000000).getInt(2000000); - gregtechproxy.mExplosionItemDrop = tMainConfig.get("general", "ExplosionItemDrops", false).getBoolean(false); + + //Pollution: edit GT_Proxy.java to change default values + gregtechproxy.mPollution = tMainConfig.get("Pollution", "EnablePollution", gregtechproxy.mPollution).getBoolean(gregtechproxy.mPollution); + gregtechproxy.mPollutionSmogLimit = tMainConfig.get("Pollution", "SmogLimit", gregtechproxy.mPollutionSmogLimit).getInt(gregtechproxy.mPollutionSmogLimit); + gregtechproxy.mPollutionPoisonLimit = tMainConfig.get("Pollution", "PoisonLimit", gregtechproxy.mPollutionPoisonLimit).getInt(gregtechproxy.mPollutionPoisonLimit); + gregtechproxy.mPollutionVegetationLimit = tMainConfig.get("Pollution", "VegetationLimit", gregtechproxy.mPollutionVegetationLimit).getInt(gregtechproxy.mPollutionVegetationLimit); + gregtechproxy.mPollutionSourRainLimit = tMainConfig.get("Pollution", "SourRainLimit", gregtechproxy.mPollutionSourRainLimit).getInt(gregtechproxy.mPollutionSourRainLimit); + gregtechproxy.mPollutionOnExplosion = tMainConfig.get("Pollution", "SourRainLimit", gregtechproxy.mPollutionOnExplosion).getInt(gregtechproxy.mPollutionOnExplosion); + gregtechproxy.mExplosionItemDrop = tMainConfig.get("general", "ExplosionItemDrops", gregtechproxy.mExplosionItemDrop).getBoolean(gregtechproxy.mExplosionItemDrop); + gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond = tMainConfig.get("Pollution", "PollutionPrimitiveBlastFurnace", gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond).getInt(gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond); + gregtechproxy.mPollutionCharcoalPitPerSecond = tMainConfig.get("Pollution", "PollutionCharcoalPit", gregtechproxy.mPollutionCharcoalPitPerSecond).getInt(gregtechproxy.mPollutionCharcoalPitPerSecond); + gregtechproxy.mPollutionEBFPerSecond = tMainConfig.get("Pollution", "PollutionEBF", gregtechproxy.mPollutionEBFPerSecond).getInt(gregtechproxy.mPollutionEBFPerSecond); + gregtechproxy.mPollutionLargeCombustionEnginePerSecond = tMainConfig.get("Pollution", "PollutionLargeCombustionEngine",gregtechproxy.mPollutionLargeCombustionEnginePerSecond).getInt(gregtechproxy.mPollutionLargeCombustionEnginePerSecond); + gregtechproxy.mPollutionExtremeCombustionEnginePerSecond = tMainConfig.get("Pollution", "PollutionExtremeCombustionEngine",gregtechproxy.mPollutionExtremeCombustionEnginePerSecond).getInt(gregtechproxy.mPollutionExtremeCombustionEnginePerSecond); + gregtechproxy.mPollutionImplosionCompressorPerSecond = tMainConfig.get("Pollution", "PollutionImplosionCompressor", gregtechproxy.mPollutionImplosionCompressorPerSecond).getInt(gregtechproxy.mPollutionImplosionCompressorPerSecond); + gregtechproxy.mPollutionLargeBronzeBoilerPerSecond = tMainConfig.get("Pollution", "PollutionLargeBronzeBoiler", gregtechproxy.mPollutionLargeBronzeBoilerPerSecond).getInt(gregtechproxy.mPollutionLargeBronzeBoilerPerSecond); + gregtechproxy.mPollutionLargeSteelBoilerPerSecond = tMainConfig.get("Pollution", "PollutionLargeSteelBoiler", gregtechproxy.mPollutionLargeSteelBoilerPerSecond).getInt(gregtechproxy.mPollutionLargeSteelBoilerPerSecond); + gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond = tMainConfig.get("Pollution", "PollutionLargeTitaniumBoiler", gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond ).getInt(gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond ); + gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond = tMainConfig.get("Pollution", "PollutionLargeTungstenSteelBoiler", gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond).getInt(gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond); + gregtechproxy.mPollutionReleasedByThrottle = tMainConfig.get("Pollution", "PollutionReleasedByThrottle", gregtechproxy.mPollutionReleasedByThrottle).getDouble(gregtechproxy.mPollutionReleasedByThrottle); + gregtechproxy.mPollutionLargeGasTurbinePerSecond = tMainConfig.get("Pollution", "PollutionLargeGasTurbine", gregtechproxy.mPollutionLargeGasTurbinePerSecond).getInt( gregtechproxy.mPollutionLargeGasTurbinePerSecond); + gregtechproxy.mPollutionMultiSmelterPerSecond = tMainConfig.get("Pollution", "PollutionMultiSmelter", gregtechproxy.mPollutionMultiSmelterPerSecond).getInt(gregtechproxy.mPollutionMultiSmelterPerSecond); + gregtechproxy.mPollutionPyrolyseOvenPerSecond = tMainConfig.get("Pollution", "PollutionPyrolyseOven", gregtechproxy.mPollutionPyrolyseOvenPerSecond).getInt(gregtechproxy.mPollutionPyrolyseOvenPerSecond); + gregtechproxy.mPollutionSmallCoalBoilerPerSecond = tMainConfig.get("Pollution", "PollutionSmallCoalBoiler", gregtechproxy.mPollutionSmallCoalBoilerPerSecond).getInt(gregtechproxy.mPollutionSmallCoalBoilerPerSecond); + gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond = tMainConfig.get("Pollution", "PollutionHighPressureLavaBoiler", gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond).getInt(gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond); + gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond = tMainConfig.get("Pollution", "PollutionHighPressureCoalBoiler", gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond).getInt(gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond); + gregtechproxy.mPollutionBaseDieselGeneratorPerSecond = tMainConfig.get("Pollution", "PollutionBaseDieselGenerator",gregtechproxy.mPollutionBaseDieselGeneratorPerSecond).getInt(gregtechproxy.mPollutionBaseDieselGeneratorPerSecond); + gregtechproxy.mPollutionDieselGeneratorReleasedByTier = tMainConfig.get("Pollution", "PollutionReleasedByTierDieselGenerator", gregtechproxy.mPollutionDieselGeneratorReleasedByTier).getDoubleList(); + gregtechproxy.mPollutionBaseGasTurbinePerSecond = tMainConfig.get("Pollution", "PollutionBaseGasTurbineGenerator", gregtechproxy.mPollutionBaseGasTurbinePerSecond).getInt(gregtechproxy.mPollutionBaseGasTurbinePerSecond); + gregtechproxy.mPollutionGasTurbineReleasedByTier = tMainConfig.get("Pollution", "PollutionReleasedByTierGasTurbineGenerator", gregtechproxy.mPollutionGasTurbineReleasedByTier).getDoubleList(); + gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundfluid"); gregtechproxy.mEnableCleanroom = tMainConfig.get("general", "EnableCleanroom", true).getBoolean(true); if (gregtechproxy.mEnableCleanroom) diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index ff875c4884..12fc6b6814 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -19,7 +19,15 @@ import gregtech.api.objects.GT_HashSet; import gregtech.api.objects.GT_ItemStack; import gregtech.api.threads.GT_Runnable_Cable_Update; import gregtech.api.threads.GT_Runnable_MachineBlockUpdate; -import gregtech.api.util.*; +import gregtech.api.util.GT_CircuitryBehavior; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.GT_CoverBehaviorBase; +import gregtech.api.util.GT_CreativeTab; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gregtech.api.world.GT_Worldgen; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -30,10 +38,19 @@ import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.GT_Values.B; +import static gregtech.api.enums.GT_Values.L; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.MOD_ID_IC2; /** * Please do not include this File in your Mod-download as it ruins compatiblity, like with the IC2-API @@ -161,6 +178,8 @@ public class GregTech_API { sHeatHazmatList = new GT_HashSet<>(), sRadioHazmatList = new GT_HashSet<>(), sElectroHazmatList = new GT_HashSet<>(); + private static final List<ItemStack> sRealConfigurationList = new ArrayList<>(); + private static final List<ItemStack> sConfigurationList = Collections.unmodifiableList(sRealConfigurationList); /** * The List of Dimensions, which are Whitelisted for the Teleporter. This list should not contain other Planets. * Mystcraft Dimensions and other Dimensional Things should be allowed. @@ -614,6 +633,31 @@ public class GregTech_API { } } + /** + * Register a new ItemStack as configuration circuits. + * Duplicates or invalid stacks will be silently ignored. + */ + public static void registerConfigurationCircuit(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) + return; + for (ItemStack tRegistered : sRealConfigurationList) + if (GT_Utility.areStacksEqual(tRegistered, aStack)) + return; + sRealConfigurationList.add(GT_Utility.copyAmount(0, aStack)); + } + + /** + * Get a list of Configuration circuits. All of these stacks will have a stack size of 0. + * Use {@link #registerConfigurationCircuit(ItemStack)} to add to this list. + * + * @return An unmodifiable view of actual list. + * It will reflect the changes to the underlying list as new circuits are registered. + * DO NOT MODIFY THE ItemStacks! + */ + public static List<ItemStack> getConfigurationCircuitList() { + return sConfigurationList; + } + public static void registerCover(ItemStack aStack, ITexture aCover, GT_CoverBehavior aBehavior) { registerCover(aStack, aCover, (GT_CoverBehaviorBase<?>) aBehavior); } @@ -812,5 +856,4 @@ public class GregTech_API { public static void setItemIconRegister(IIconRegister aIconRegister) { GregTech_API.sItemIcons = aIconRegister; } - } diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index a24c4acbcd..e1f3c3f0e0 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -73,7 +73,7 @@ public class NodeEnergyReceiver extends ConsumerNode { tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) - GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); + GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), GT_Mod.gregtechproxy.mPollutionOnExplosion); new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() .setStrength(tStrength) diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java index fbae0b6752..3c1d35c771 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java @@ -11,7 +11,8 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; + +import java.util.List; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT; @@ -36,10 +37,13 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 63, false, true, 1)); addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 26, 63, false, true, 1)); addSlotToContainer(new GT_Slot_Render(mTileEntity, 2, 107, 63)); + GT_MetaTileEntity_BasicMachine machine = (GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity(); + if (machine.allowSelectCircuit()) + addSlotToContainer(new GT_Slot_Render(mTileEntity, machine.getCircuitSlot(), 153, 63)); - int tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getInputSlot(); + int tStartIndex = machine.getInputSlot(); - switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mInputSlotCount) { + switch (machine.mInputSlotCount) { case 0: break; case 1: @@ -107,9 +111,9 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { break; } - tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getOutputSlot(); + tStartIndex = machine.getOutputSlot(); - switch (((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mOutputItems.length) { + switch (machine.mOutputItems.length) { case 0: break; case 1: @@ -182,8 +186,20 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { addSlotToContainer(new GT_Slot_Render(mTileEntity, tStartIndex++, 53, 63)); } + private static int find(List<ItemStack> aStacks, ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) + return -1; + for (int i = 0, aStacksSize = aStacks.size(); i < aStacksSize; i++) { + ItemStack tStack = aStacks.get(i); + if (GT_Utility.areStacksEqual(aStack, tStack)) + return i; + } + return -1; + } + @Override public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (mTileEntity.getMetaTileEntity() == null) return null; GT_MetaTileEntity_BasicMachine machine = (GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity(); if (machine == null) return null; ItemStack tResultStack; @@ -192,9 +208,36 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { machine.mFluidTransfer = !machine.mFluidTransfer; return null; case 1: - if (mTileEntity.getMetaTileEntity() == null) return null; machine.mItemTransfer = !machine.mItemTransfer; return null; + case 3: + if (machine.allowSelectCircuit() && aMouseclick < 2) { + ItemStack newCircuit; + if (aMouseclick == 1 && aShifthold == 1) { + // clear + newCircuit = null; + } else { + ItemStack cursorStack = aPlayer.inventory.getItemStack(); + List<ItemStack> tCircuits = machine.getConfigurationCircuits(); + int index = find(tCircuits, cursorStack); + if (index < 0) { + int curIndex = find(tCircuits, machine.getStackInSlot(machine.getCircuitSlot())) + 1; + if (aMouseclick == 0) { + curIndex += 1; + } else { + curIndex -= 1; + } + curIndex = Math.floorMod(curIndex, tCircuits.size() + 1) - 1; + newCircuit = curIndex < 0 ? null : tCircuits.get(curIndex); + } else { + // set to whatever it is + newCircuit = tCircuits.get(index); + } + } + mTileEntity.setInventorySlotContents(machine.getCircuitSlot(), newCircuit); + return newCircuit; + } + return null; default: if (aSlotIndex == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length && aMouseclick < 2) { if (mTileEntity.isClientSide()) { @@ -255,12 +298,12 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank { @Override public int getSlotStartIndex() { - return 3; + return 4; } @Override public int getShiftClickStartIndex() { - return 3; + return 4; } @Override diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java index e8810c14c0..79d3636068 100644 --- a/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java +++ b/src/main/java/gregtech/api/gui/GT_Container_BasicTank.java @@ -28,6 +28,10 @@ public class GT_Container_BasicTank extends GT_ContainerMetaTile_Machine { super(aInventoryPlayer, aTileEntity); } + /** + * Subclasses must ensure third slot (aSlotIndex==2) is drainable fluid display item slot. + * Otherwise, subclasses must intercept the appropriate the slotClick event and call super.slotClick(2, xxx) if necessary + */ @Override public void addSlots(InventoryPlayer aInventoryPlayer) { addSlotToContainer(new Slot(mTileEntity, 0, 80, 17)); diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index 2267b6c241..9d66e38060 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -407,6 +407,8 @@ public interface IGT_RecipeAdder { */ boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int aDuration, int aEUt); + boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int[] aChances, int aDuration, int aEUt); + /** * Adds an Implosion Compressor Recipe * @@ -488,6 +490,8 @@ public interface IGT_RecipeAdder { */ boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int aDuration, int aEUt); + boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt); + /** * Adds an Unboxing Recipe */ diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index 24d0576864..30a5230168 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -113,7 +113,7 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd tWorld.setBlock(tX, tY, tZ, Blocks.air); if (GregTech_API.sMachineExplosions) if (GT_Mod.gregtechproxy.mPollution) - GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), 100000); + GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX, tZ), GT_Mod.gregtechproxy.mPollutionOnExplosion); new WorldSpawnedEventBuilder.ExplosionEffectEventBuilder() .setStrength(tStrength) diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 9176d063ce..f2514f1290 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -270,7 +270,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE for (int i = 0; i < tItemList.tagCount(); i++) { NBTTagCompound tTag = tItemList.getCompoundTagAt(i); int tSlot = tTag.getInteger("IntSlot"); - tSlot = shiftInventoryIndex(tSlot, nbtVersion); + tSlot = migrateInventoryIndex(tSlot, nbtVersion); if (tSlot >= 0 && tSlot < mMetaTileEntity.getRealInventory().length) { mMetaTileEntity.getRealInventory()[tSlot] = GT_Utility.loadItem(tTag); } @@ -481,7 +481,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE if (mMetaTileEntity.isEnetOutput() && oOutput > 0) { - long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); + long tOutputVoltage = Math.max(oOutput, oOutput + (1L << Math.max(0, GT_Utility.getTier(oOutput) - 1))), + tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage); if (tUsableAmperage > 0) { long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this); mAverageEUOutput[mAverageEUOutputIndex] += tEU; @@ -1403,7 +1404,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } } - GT_Pollution.addPollution(this, 100000); + GT_Pollution.addPollution(this, GT_Mod.gregtechproxy.mPollutionOnExplosion); mMetaTileEntity.doExplosion(aAmount); } } @@ -2308,9 +2309,13 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE * @param nbtVersion The GregTech version in which the original Inventory Index was saved. * @return The corrected Inventory index */ - private int shiftInventoryIndex(int slotIndex, int nbtVersion){ + private int migrateInventoryIndex(int slotIndex, int nbtVersion){ int oldInputSize, newInputSize, oldOutputSize, newOutputSize; int chemistryUpdateVersion = GT_Mod.calculateTotalGTVersion(509, 31); + int configCircuitAdditionVersion = GT_Mod.calculateTotalGTVersion(509, 40); + // 4 is old GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT + if (nbtVersion < configCircuitAdditionVersion && getMetaTileEntity() instanceof GT_MetaTileEntity_BasicMachine && slotIndex >= 4) + slotIndex += 1; if (mID >= 211 && mID <= 218) {//Assembler if (nbtVersion < chemistryUpdateVersion) { oldInputSize = 2; diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index b3c25ff345..3c499aea53 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -5,6 +5,8 @@ import appeng.me.helpers.AENetworkProxy; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gnu.trove.list.TIntList; +import gnu.trove.list.array.TIntArrayList; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index bb7b795c36..289a43fdd8 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -117,7 +117,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public boolean isFacingValid(byte aSide) { - return aSide > 1; + return true; } @Override @@ -214,7 +214,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); //long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);//TODO CHECK if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { - GT_Pollution.addPollution(getBaseMetaTileEntity(),10 * getPollution()); + // divided by two because this is called every 10 ticks, not 20 + GT_Pollution.addPollution(getBaseMetaTileEntity(),getPollution()/2); mFluid.amount -= tFluidAmountToUse * tConsumed; } } @@ -229,7 +230,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); - GT_Pollution.addPollution(getBaseMetaTileEntity(),10 * getPollution()); + // divided by two because this is called every 10 ticks, not 20 + GT_Pollution.addPollution(getBaseMetaTileEntity(),getPollution()/2); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index e8cac808dd..8f77b6ac5a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -31,6 +31,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; import java.util.Arrays; +import java.util.List; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.debugCleanroom; @@ -53,7 +54,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B DID_NOT_FIND_RECIPE = 0, FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1, FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2; - public static final int OTHER_SLOT_COUNT = 4; + public static final int OTHER_SLOT_COUNT = 5; public final ItemStack[] mOutputItems; public final int mInputSlotCount, mAmperage; public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false; @@ -694,8 +695,11 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } protected ItemStack[] getAllInputs() { - ItemStack[] rInputs = new ItemStack[mInputSlotCount]; + int tRealInputSlotCount = this.mInputSlotCount + (allowSelectCircuit() ? 1 : 0); + ItemStack[] rInputs = new ItemStack[tRealInputSlotCount]; for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i); + if (allowSelectCircuit()) + rInputs[mInputSlotCount] = getStackInSlot(getCircuitSlot()); return rInputs; } @@ -850,6 +854,26 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B return mInventory[aIndex] == null; } + public boolean allowSelectCircuit() { + return false; + } + + /** + * This might be non-final in the future, but for now, no, don't change this. + */ + public final int getCircuitSlot() { + return 4; + } + + /** + * Return a list of possible configuration circuit this machine expects. + * + * This list is unmodifiable. Its elements are not supposed to be modified in any way! + */ + public List<ItemStack> getConfigurationCircuits() { + return GregTech_API.getConfigurationCircuitList(); + } + /** * @return the Recipe List which is used for this Machine, this is a useful Default Handler */ diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 281d0f6541..7cd9fe65e1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -813,6 +813,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ } } + @Override + public boolean allowSelectCircuit() { + return true; + } @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java index 7b99d78009..552d3d6587 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java @@ -16,7 +16,7 @@ import net.minecraftforge.fluids.FluidTankInfo; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> + * * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually */ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_TieredMachineBlock implements IHasFluidDisplayItem { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 6369c48f8e..f7b15f2c44 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -398,7 +398,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { /** * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) */ - public abstract int getPollutionPerTick(ItemStack aStack); + public int getPollutionPerTick(ItemStack aStack){ + return getPollutionPerSecond(aStack)/20; + } + + /** + * Gets the pollution produced per second by this multiblock, default to 0. Override this with + * its actual value in the code of the multiblock. + */ + public int getPollutionPerSecond(ItemStack aStack){ + return 0; + } /** * Gets the damage to the ItemStack, usually 0 or 1. @@ -539,7 +549,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { GT_Log.exp.println("MultiBlockExplosion at: " +this.getBaseMetaTileEntity().getXCoord()+" | "+this.getBaseMetaTileEntity().getYCoord()+" | "+this.getBaseMetaTileEntity().getZCoord()+" DIMID: "+ this.getBaseMetaTileEntity().getWorld().provider.dimensionId+"."); - GT_Pollution.addPollution(getBaseMetaTileEntity(), 300000); + GT_Pollution.addPollution(getBaseMetaTileEntity(), GT_Mod.gregtechproxy.mPollutionOnExplosion); mInventory[1] = null; for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java index f35f1962d1..62238a8112 100644 --- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java +++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java @@ -2,6 +2,7 @@ package gregtech.api.util; import static gregtech.GT_Mod.GT_FML_LOGGER; +import java.util.Arrays; import java.util.HashMap; import cpw.mods.fml.common.FMLCommonHandler; @@ -14,7 +15,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; import net.minecraftforge.fluids.FluidStack; -import scala.actors.threadpool.Arrays; public class GT_AssemblyLineUtils { @@ -159,7 +159,7 @@ public class GT_AssemblyLineUtils { for (GT_Recipe_AssemblyLine aRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { if (aRecipe.mEUt == aEU && aRecipe.mDuration == aTime) { if (GT_Utility.areStacksEqual(aOutputs[0], aRecipe.mOutput, true)) { - if (Arrays.equals(aRecipe.mInputs, aInputs) && Arrays.equals(aRecipe.mFluidInputs, aFluidInputs)) { + if (Arrays.equals(aRecipe.mInputs, aInputs) && Arrays.equals(aRecipe.mFluidInputs, aFluidInputs)) { // Cache it String aRecipeHash = generateRecipeHash(aRecipe); sRecipeCacheByRecipeHash.put(aRecipeHash, aRecipe); diff --git a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java index bd9148b516..184f6f1011 100644 --- a/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java +++ b/src/main/java/gregtech/api/util/GT_ChunkAssociatedData.java @@ -104,7 +104,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } private ChunkCoordIntPair getRegionID(int aChunkX, int aChunkZ) { - return new ChunkCoordIntPair(aChunkX / regionLength, aChunkZ / regionLength); + return new ChunkCoordIntPair(Math.floorDiv(aChunkX, regionLength), Math.floorDiv(aChunkZ, regionLength)); } /** @@ -168,7 +168,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } private void saveRegions(Stream<SuperRegion> stream) { - stream.filter(r -> !r.isDirty()) + stream.filter(r -> r.isDirty()) .map(c -> (Runnable) c::save) .map(r -> CompletableFuture.runAsync(r, IO_WORKERS)) .reduce(CompletableFuture::allOf) @@ -242,7 +242,12 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } protected File getSaveDirectory(World w) { - return new File(w.getSaveHandler().getWorldDirectory(), "gregtech"); + File base; + if (w.provider.getSaveFolder() == null) + base = w.getSaveHandler().getWorldDirectory(); + else + base = new File(w.getSaveHandler().getWorldDirectory(), w.provider.getSaveFolder()); + return new File(base, "gregtech"); } public interface IData { @@ -256,20 +261,23 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID private final T[] data = createData(); private final File backingStorage; private final WeakReference<World> world; + /** + * Be aware, this means region coord, not bottom-left chunk coord + */ private final ChunkCoordIntPair coord; - private SuperRegion(World world, int chunkX, int chunkZ) { + private SuperRegion(World world, int regionX, int regionZ) { this.world = new WeakReference<>(world); - this.coord = new ChunkCoordIntPair(chunkX, chunkZ); - backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, chunkX, chunkZ)); + this.coord = new ChunkCoordIntPair(regionX, regionZ); + backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, regionX, regionZ)); if (backingStorage.isFile()) load(); } - private SuperRegion(World world, ChunkCoordIntPair coord) { + private SuperRegion(World world, ChunkCoordIntPair regionCoord) { this.world = new WeakReference<>(world); - this.coord = coord; - backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, coord.chunkXPos, coord.chunkZPos)); + this.coord = regionCoord; + backingStorage = new File(getSaveDirectory(world), String.format("%s.%d.%d.dat", mId, regionCoord.chunkXPos, regionCoord.chunkZPos)); if (backingStorage.isFile()) load(); } @@ -296,7 +304,7 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } public boolean isCreated(int subRegionX, int subRegionZ) { - return this.data[getIndex(subRegionX, subRegionZ)] == null; + return this.data[getIndex(subRegionX, subRegionZ)] != null; } public ChunkCoordIntPair getCoord() { @@ -308,16 +316,16 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } private int getChunkX(int index) { - return index / regionLength + coord.chunkXPos; + return index / regionLength + coord.chunkXPos * regionLength; } private int getChunkZ(int index) { - return index % regionLength + coord.chunkZPos; + return index % regionLength + coord.chunkZPos * regionLength; } public boolean isDirty() { for (T datum : data) { - if (datum != null && datum.isSameAsDefault()) + if (datum != null && !datum.isSameAsDefault()) return true; } return false; @@ -333,8 +341,6 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID } private void save0() throws IOException { - if (!isDirty()) - return; //noinspection ResultOfMethodCallIgnored backingStorage.getParentFile().mkdirs(); File tmpFile = getTmpFile(); @@ -392,19 +398,32 @@ public abstract class GT_ChunkAssociatedData<T extends GT_ChunkAssociatedData.ID private void loadFromFile(File file) throws IOException { World world = Objects.requireNonNull(this.world.get(), "Attempting to load region of another world!"); try (DataInputStream input = new DataInputStream(new FileInputStream(file))) { - boolean nullRange = input.readBoolean(); - int ptr = 0; - while (ptr != data.length) { - int rangeEnd = ptr + input.readUnsignedShort(); - if (!nullRange) { - for (; ptr < rangeEnd; ptr++) { - data[ptr] = readElement(input, version, world, getChunkX(ptr), getChunkZ(ptr)); - } - } else { - Arrays.fill(data, ptr, rangeEnd, null); - ptr = rangeEnd; + byte b = input.readByte(); + switch (b) { + case 0: + loadV0(input, world); + break; + default: + GT_Log.err.printf("Unknown ChunkAssociatedData version %d\n", b); + } + } + } + + private void loadV0(DataInput input, World world) throws IOException { + int version = input.readByte(); + boolean nullRange = input.readBoolean(); + int ptr = 0; + while (ptr != data.length) { + int rangeEnd = ptr + input.readUnsignedShort(); + if (!nullRange) { + for (; ptr < rangeEnd; ptr++) { + data[ptr] = readElement(input, version, world, getChunkX(ptr), getChunkZ(ptr)); } + } else { + Arrays.fill(data, ptr, rangeEnd, null); + ptr = rangeEnd; } + nullRange = !nullRange; } } diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 810a204c40..acd9a294f9 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -797,6 +797,13 @@ public class GT_ModHandler { /** * IC2-ThermalCentrifuge Recipe. Overloads old Recipes automatically */ + public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int[] aChances, int aHeat, Object... aOutput) { + if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; + if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false; + RA.addThermalCentrifugeRecipe(aInput, aOutput.length >= 1 ? (ItemStack)aOutput[0] : null, aOutput.length >= 2 ? (ItemStack)aOutput[1] : null, aOutput.length >= 3 ? (ItemStack)aOutput[2] : null, aChances, 500, 48); + return true; + } + public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int aHeat, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false; @@ -807,11 +814,19 @@ public class GT_ModHandler { /** * IC2-OreWasher Recipe. Overloads old Recipes automatically */ + public static boolean addOreWasherRecipe(ItemStack aInput, int[] aChances, int aWaterAmount, Object... aOutput) { + if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; + if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; + RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getWater(aWaterAmount), aChances, 500, 16); + RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getDistilledWater(aWaterAmount / 5), aChances, 300, 16); + return true; + } + public static boolean addOreWasherRecipe(ItemStack aInput, int aWaterAmount, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false; if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; - RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getWater(1000L), 500, 16); - RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getDistilledWater(200L), 300, 16); + RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getWater(aWaterAmount), 500, 16); + RA.addOreWasherRecipe(aInput, (ItemStack)aOutput[0], (ItemStack)aOutput[1], (ItemStack)aOutput[2], GT_ModHandler.getDistilledWater(aWaterAmount / 5), 300, 16); return true; } diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index c0ea06af07..6e12a3d36c 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -1585,23 +1585,8 @@ public class GT_Recipe implements Comparable<GT_Recipe> { GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); if (aInputs == null || aInputs.length < 2 || aInputs[0] == null || aInputs[1] == null || !GregTech_API.sPostloadFinished) return rRecipe; - if (rRecipe == null) { - if (ItemList.Shape_Mold_Name.isStackEqual(aInputs[0], false, true)) { - ItemStack tOutput = GT_Utility.copyAmount(1, aInputs[1]); - tOutput.setStackDisplayName(aInputs[0].getDisplayName()); - rRecipe = new GT_Recipe(false, new ItemStack[]{ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, aInputs[1])}, new ItemStack[]{tOutput}, null, null, null, null, 128, 8, 0); - rRecipe.mCanBeBuffered = false; - return rRecipe; - } - if (ItemList.Shape_Mold_Name.isStackEqual(aInputs[1], false, true)) { - ItemStack tOutput = GT_Utility.copyAmount(1, aInputs[0]); - tOutput.setStackDisplayName(aInputs[1].getDisplayName()); - rRecipe = new GT_Recipe(false, new ItemStack[]{ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, aInputs[0])}, new ItemStack[]{tOutput}, null, null, null, null, 128, 8, 0); - rRecipe.mCanBeBuffered = false; - return rRecipe; - } - return null; - } + if (rRecipe == null) + return findRenamingRecipe(aInputs); for (ItemStack aMold : aInputs) { if (ItemList.Shape_Mold_Credit.isStackEqual(aMold, false, true)) { NBTTagCompound tNBT = aMold.getTagCompound(); @@ -1617,6 +1602,40 @@ public class GT_Recipe implements Comparable<GT_Recipe> { } return rRecipe; } + + private ItemStack findNameMoldIndex(ItemStack[] inputs) { + for (ItemStack stack: inputs) { + if (ItemList.Shape_Mold_Name.isStackEqual(stack, false, true)) + return stack; + } + return null; + } + + private ItemStack findStackToRename(ItemStack[] inputs, ItemStack mold) { + for (ItemStack stack: inputs) { + if (stack == mold || stack == null) + continue; + return stack; + } + return null; + } + + private GT_Recipe findRenamingRecipe(ItemStack[] inputs) { + ItemStack mold = findNameMoldIndex(inputs); + if (mold == null) + return null; + ItemStack input = findStackToRename(inputs, mold); + if (input == null) + return null; + ItemStack output = GT_Utility.copyAmount(1, input); + output.setStackDisplayName(mold.getDisplayName()); + GT_Recipe recipe = new GT_Recipe(false, + new ItemStack[]{ ItemList.Shape_Mold_Name.get(0), GT_Utility.copyAmount(1, input) }, + new ItemStack[]{ output }, + null, null, null, null, 128, 8, 0); + recipe.mCanBeBuffered = false; + return recipe; + } } /** diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java index 865fa83f7e..afaac41650 100644 --- a/src/main/java/gregtech/common/GT_Pollution.java +++ b/src/main/java/gregtech/common/GT_Pollution.java @@ -9,6 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.net.GT_Packet_Pollution; import gregtech.api.util.GT_ChunkAssociatedData; import gregtech.api.util.GT_Utility; +import gregtech.common.render.GT_PollutionRenderer; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; @@ -27,12 +28,16 @@ import net.minecraftforge.event.world.ChunkDataEvent; import net.minecraftforge.event.world.ChunkWatchEvent; import net.minecraftforge.event.world.WorldEvent; +import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; +import java.util.function.Consumer; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import static gregtech.common.GT_Proxy.dimensionWisePollution; @@ -73,11 +78,12 @@ public class GT_Pollution { * Muffler Hatch Pollution reduction: ** inaccurate ** * LV (0%), MV (30%), HV (52%), EV (66%), IV (76%), LuV (84%), ZPM (89%), UV (92%), MAX (95%) */ - private List<ChunkCoordIntPair> pollutionList = new ArrayList<>();//chunks left to process - private final List<ChunkCoordIntPair> chunkData = new ArrayList<>();//link to chunk data that is saved/loaded + private List<ChunkCoordIntPair> pollutionList = new ArrayList<>();//chunks left to process in this cycle + private final Set<ChunkCoordIntPair> pollutedChunks = new HashSet<>();// a global list of all chunks with positive pollution private int operationsPerTick = 0;//how much chunks should be processed in each cycle private static final short cycleLen = 1200; private final World world; + private boolean blank = true; public static int mPlayerPollution; private static int POLLUTIONPACKET_MINVALUE = 1000; @@ -96,6 +102,7 @@ public class GT_Pollution { public static void onWorldTick(TickEvent.WorldTickEvent aEvent) {//called from proxy //return if pollution disabled if (!GT_Mod.gregtechproxy.mPollution) return; + if (aEvent.phase == TickEvent.Phase.START) return; final GT_Pollution pollutionInstance = dimensionWisePollution.get(aEvent.world.provider.dimensionId); if (pollutionInstance == null) return; pollutionInstance.tickPollutionInWorld((int) (aEvent.world.getTotalWorldTime() % cycleLen)); @@ -103,16 +110,18 @@ public class GT_Pollution { private void tickPollutionInWorld(int aTickID) {//called from method above //gen data set - if (aTickID == 0) { + if (aTickID == 0 || blank) { // make a snapshot of what to work on - // counterintuitive as it seems, but this is the fastest way java collections framework offers us. - pollutionList = new ArrayList<>(chunkData); + pollutionList = new ArrayList<>(pollutedChunks); //set operations per tick - if (pollutionList.size() > 0) operationsPerTick = (pollutionList.size() / cycleLen); - else operationsPerTick = 0;//SANity + if (pollutionList.size() > 0) + operationsPerTick = Math.max(1, pollutionList.size() / cycleLen); + else + operationsPerTick = 0; //SANity + blank = false; } - for (int chunksProcessed = 0; chunksProcessed <= operationsPerTick; chunksProcessed++) { + for (int chunksProcessed = 0; chunksProcessed < operationsPerTick; chunksProcessed++) { if (pollutionList.size() == 0) break;//no more stuff to do ChunkCoordIntPair actualPos = pollutionList.remove(pollutionList.size() - 1);//faster //get pollution @@ -120,10 +129,8 @@ public class GT_Pollution { int tPollution = currentData.getAmount(); //remove some tPollution = (int) (0.9945f * tPollution); - //tPollution -= 2000;//This does not really matter... - if (tPollution <= 0) tPollution = 0;//SANity check - else if (tPollution > 400000) {//Spread Pollution + if (tPollution > 400000) {//Spread Pollution ChunkCoordIntPair[] tNeighbors = new ChunkCoordIntPair[4];//array is faster tNeighbors[0] = (new ChunkCoordIntPair(actualPos.chunkXPos + 1, actualPos.chunkZPos)); @@ -138,7 +145,7 @@ public class GT_Pollution { tDiff = tDiff / 20; neighborPollution = GT_Utility.safeInt((long) neighborPollution + tDiff);//tNPol += tDiff; tPollution -= tDiff; - neighbor.setAmount(neighborPollution); + setChunkPollution(neighborPosition, neighborPollution); } } @@ -200,7 +207,7 @@ public class GT_Pollution { } } //Write new pollution to Hashmap !!! - currentData.setAmount(tPollution); + setChunkPollution(actualPos, tPollution); //Send new value to players nearby if (tPollution > POLLUTIONPACKET_MINVALUE) { @@ -210,6 +217,10 @@ public class GT_Pollution { } } + private void setChunkPollution(ChunkCoordIntPair coord, int pollution) { + mutatePollution(world, coord.chunkXPos, coord.chunkZPos, c -> c.setAmount(pollution), pollutedChunks); + } + private static void damageBlock(World world, int x, int y, int z, boolean sourRain) { if (world.isRemote) return; Block tBlock = world.getBlock(x, y, z); @@ -265,23 +276,81 @@ public class GT_Pollution { } } + private static GT_Pollution getPollutionManager(World world) { + return dimensionWisePollution.computeIfAbsent(world.provider.dimensionId, i -> new GT_Pollution(world)); + } + + /** @see #addPollution(World, int, int, int) */ public static void addPollution(IGregTechTileEntity te, int aPollution) { - addPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(), te.getZCoord()), aPollution); + if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0 || te.isClientSide()) return; + mutatePollution(te.getWorld(), te.getXCoord() >> 4, te.getZCoord() >> 4, d -> d.changeAmount(aPollution), null); } + /** @see #addPollution(World, int, int, int) */ public static void addPollution(Chunk ch, int aPollution) { - if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0) return; - STORAGE.get(ch).changeAmount(aPollution); + if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0 || ch.worldObj.isRemote) return; + mutatePollution(ch.worldObj, ch.xPosition, ch.zPosition, d -> d.changeAmount(aPollution), null); + } + + /** + * Add some pollution to given chunk. Can pass in negative to remove pollution. + * Will clamp the final pollution number to 0 if it would be changed into negative. + * + * @param w world to modify. do nothing if it's a client world + * @param chunkX chunk coordinate X, i.e. blockX >> 4 + * @param chunkZ chunk coordinate Z, i.e. blockZ >> 4 + * @param aPollution desired delta. Positive means the pollution in chunk would go higher. + */ + public static void addPollution(World w, int chunkX, int chunkZ, int aPollution) { + if (!GT_Mod.gregtechproxy.mPollution || aPollution == 0 || w.isRemote) return; + mutatePollution(w, chunkX, chunkZ, d -> d.changeAmount(aPollution), null); + } + + private static void mutatePollution(World world, int x, int z, Consumer<ChunkData> mutator, @Nullable Set<ChunkCoordIntPair> chunks) { + ChunkData data = STORAGE.get(world, x, z); + boolean hadPollution = data.getAmount() > 0; + mutator.accept(data); + boolean hasPollution = data.getAmount() > 0; + if (hasPollution != hadPollution) { + if (chunks == null) + chunks = getPollutionManager(world).pollutedChunks; + if (hasPollution) + chunks.add(new ChunkCoordIntPair(x, z)); + else + chunks.remove(new ChunkCoordIntPair(x, z)); + } } + /** @see #getPollution(World, int, int) */ public static int getPollution(IGregTechTileEntity te) { - return getPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(), te.getZCoord())); + return getPollution(te.getWorld(), te.getXCoord() >> 4, te.getZCoord() >> 4); } + /** @see #getPollution(World, int, int) */ public static int getPollution(Chunk ch) { + return getPollution(ch.worldObj, ch.xPosition, ch.zPosition); + } + + /** + * Get the pollution in specified chunk + * @param w world to look in. can be a client world, but that limits the knowledge to what server side send us + * @param chunkX chunk coordinate X, i.e. blockX >> 4 + * @param chunkZ chunk coordinate Z, i.e. blockZ >> 4 + * @return pollution amount. may be 0 if pollution is disabled, or if it's a client world and server did not send + * us info about this chunk + */ + public static int getPollution(World w, int chunkX, int chunkZ) { if (!GT_Mod.gregtechproxy.mPollution) return 0; - return STORAGE.get(ch).getAmount(); + if (w.isRemote) + // it really should be querying the client side stuff instead + return GT_PollutionRenderer.getKnownPollution(chunkX << 4, chunkZ << 4); + return STORAGE.get(w, chunkX, chunkZ).getAmount(); + } + + @Deprecated + public static int getPollution(ChunkCoordIntPair aCh, int aDim) { + return getPollution(DimensionManager.getWorld(aDim), aCh.chunkXPos, aCh.chunkZPos); } public static boolean hasPollution(Chunk ch) { @@ -290,12 +359,6 @@ public class GT_Pollution { return STORAGE.isCreated(ch.worldObj, ch.getChunkCoordIntPair()) && STORAGE.get(ch).getAmount() > 0; } - public static int getPollution(ChunkCoordIntPair aCh, int aDim) { - if (!GT_Mod.gregtechproxy.mPollution) - return 0; - return STORAGE.get(DimensionManager.getWorld(aDim), aCh.chunkXPos, aCh.chunkZPos).getAmount(); - } - //Add compatibility with old code @Deprecated /*Don't use it... too weird way of passing position*/ public static void addPollution(World aWorld, ChunkPosition aPos, int aPollution) { @@ -323,7 +386,8 @@ public class GT_Pollution { @SubscribeEvent public void onWorldLoad(WorldEvent.Load e) { // super class loads everything lazily. We force it to load them all. - STORAGE.loadAll(e.world); + if (!e.world.isRemote) + STORAGE.loadAll(e.world); } } @@ -340,15 +404,14 @@ public class GT_Pollution { @Override protected ChunkData readElement(DataInput input, int version, World world, int chunkX, int chunkZ) throws IOException { + if (version != 0) + throw new IOException("Region file corrupted"); ChunkData data = new ChunkData(input.readInt()); - getChunkData(world).add(new ChunkCoordIntPair(chunkX, chunkZ)); + if (data.getAmount() > 0) + getPollutionManager(world).pollutedChunks.add(new ChunkCoordIntPair(chunkX, chunkZ)); return data; } - private List<ChunkCoordIntPair> getChunkData(World world) { - return dimensionWisePollution.computeIfAbsent(world.provider.dimensionId, i -> new GT_Pollution(world)).chunkData; - } - @Override protected ChunkData createElement(World world, int chunkX, int chunkZ) { return new ChunkData(); @@ -359,11 +422,6 @@ public class GT_Pollution { super.loadAll(w); } - public void set(World world, ChunkCoordIntPair coord, ChunkData data) { - set(world, coord.chunkXPos, coord.chunkZPos, data); - getChunkData(world).add(coord); - } - public boolean isCreated(World world, ChunkCoordIntPair coord) { return isCreated(world.provider.dimensionId, coord.chunkXPos, coord.chunkZPos); } @@ -377,7 +435,7 @@ public class GT_Pollution { } private ChunkData(int amount) { - this.amount = amount; + this.amount = Math.max(0, amount); } /** diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 40716a2fa6..569e06643a 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -188,6 +188,28 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public int mPollutionPoisonLimit = 750000; public int mPollutionVegetationLimit = 1000000; public int mPollutionSourRainLimit = 2000000; + public int mPollutionOnExplosion = 100000; + public int mPollutionPrimitveBlastFurnacePerSecond = 200; + public int mPollutionEBFPerSecond = 400; + public int mPollutionCharcoalPitPerSecond = 100; + public int mPollutionLargeCombustionEnginePerSecond = 480; + public int mPollutionExtremeCombustionEnginePerSecond = 3840; + public int mPollutionImplosionCompressorPerSecond = 10000; + public int mPollutionLargeBronzeBoilerPerSecond = 1000; + public int mPollutionLargeSteelBoilerPerSecond = 2000; + public int mPollutionLargeTitaniumBoilerPerSecond = 3000; + public int mPollutionLargeTungstenSteelBoilerPerSecond = 4000; + public double mPollutionReleasedByThrottle = 1.0/24.0; // divided by 24 because 24 circuit conf + public int mPollutionLargeGasTurbinePerSecond = 300; + public int mPollutionMultiSmelterPerSecond = 400; + public int mPollutionPyrolyseOvenPerSecond = 300; + public int mPollutionSmallCoalBoilerPerSecond = 20; + public int mPollutionHighPressureLavaBoilerPerSecond = 20; + public int mPollutionHighPressureCoalBoilerPerSecond = 30; + public int mPollutionBaseDieselGeneratorPerSecond = 200; + public double[] mPollutionDieselGeneratorReleasedByTier = new double[]{0.1, 1.0, 0.9, 0.8}; + public int mPollutionBaseGasTurbinePerSecond = 200; + public double[] mPollutionGasTurbineReleasedByTier = new double[]{0.1, 1.0, 0.9, 0.8}; public final GT_UO_DimensionList mUndergroundOil = new GT_UO_DimensionList(); public int mTicksUntilNextCraftSound = 0; public double mMagneticraftBonusOutputPercent = 100.0d; @@ -236,6 +258,16 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { */ public boolean mRenderIndicatorsOnHatch = true; + /** + * This enables the rendering of dirt particles if pollution is enabled too + */ + public boolean mRenderDirtParticles = true; + + /** + * This enables the rendering of the pollution fog if pollution is enabled too + */ + public boolean mRenderPollutionFog = true; + public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15 public static Map<String, Integer> oreDictBurnTimes = new HashMap<>(); diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 1571ef7b46..4ba4601490 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -595,6 +595,20 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { } @Override + public boolean addOreWasherRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, FluidStack aFluidInput, int[] aChances, int aDuration, int aEUt) { + if ((aInput == null) || (aFluidInput == null) || ((aOutput1 == null) || (aOutput2 == null) || (aOutput3 == null))) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("orewasher", aInput, aDuration)) <= 0) { + return false; + } + GT_Recipe.GT_Recipe_Map.sOreWasherRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput1, aOutput2, aOutput3}, null, aChances, new FluidStack[]{aFluidInput}, null, aDuration, aEUt, 0); + return true; + } + + + + @Override public boolean addImplosionRecipe(ItemStack aInput1, int aInput2, ItemStack aOutput1, ItemStack aOutput2) { if ((aInput1 == null) || (aOutput1 == null)) { return false; @@ -775,6 +789,18 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { } @Override + public boolean addThermalCentrifugeRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, int[] aChances, int aDuration, int aEUt) { + if ((aInput == null) || (aOutput1 == null)) { + return false; + } + if (!GregTech_API.sRecipeFile.get("thermalcentrifuge", aInput, true)) { + return false; + } + GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput1, aOutput2, aOutput3}, null, aChances, null, null, aDuration, aEUt, 0); + return true; + } + + @Override public boolean addAmplifier(ItemStack aAmplifierItem, int aDuration, int aAmplifierAmountOutputted) { if ((aAmplifierItem == null) || (aAmplifierAmountOutputted <= 0)) { return false; diff --git a/src/main/java/gregtech/common/GT_UndergroundOil.java b/src/main/java/gregtech/common/GT_UndergroundOil.java index 21b681de4a..b725b4bbb6 100644 --- a/src/main/java/gregtech/common/GT_UndergroundOil.java +++ b/src/main/java/gregtech/common/GT_UndergroundOil.java @@ -31,22 +31,46 @@ public class GT_UndergroundOil { private static final GT_UndergroundOilStore STORAGE = new GT_UndergroundOilStore(); private static final ChunkData NIL_FLUID_STACK = new ChunkData(-1, null, null, false); + /** + * Effectively just call {@code undergroundOil(te, -1)} for you + * @see #undergroundOil(World, int, int, float) + */ public static FluidStack undergroundOilReadInformation(IGregTechTileEntity te){ return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),-1); } + /** + * Effectively just call {@code undergroundOil(chunk, -1)} for you + * @see #undergroundOil(World, int, int, float) + */ public static FluidStack undergroundOilReadInformation(Chunk chunk) { return undergroundOil(chunk,-1); } + /** @see #undergroundOil(World, int, int, float) */ public static FluidStack undergroundOil(IGregTechTileEntity te, float readOrDrainCoefficient){ return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),readOrDrainCoefficient); } //Returns whole content for information purposes -> when drainSpeedCoefficient < 0 //Else returns extracted fluidStack if amount > 0, or null otherwise + /** @see #undergroundOil(World, int, int, float) */ public static FluidStack undergroundOil(Chunk chunk, float readOrDrainCoefficient) { - ChunkData chunkData = STORAGE.get(chunk); + return undergroundOil(chunk.worldObj, chunk.xPosition, chunk.zPosition, readOrDrainCoefficient); + } + + /** + * Pump fluid or read info. + * @param w a remote World. For a WorldClient it will always tell you null + * @param chunkX chunk coordinate X, i.e. blockX >> 4 + * @param chunkZ chunk coordinate Z, i.e. blockZ >> 4 + * @param readOrDrainCoefficient how fast to pump. The higher the faster. use negative to read expected current output + * @return null if nothing here, or depleted already, or a client side world + */ + public static FluidStack undergroundOil(World w, int chunkX, int chunkZ, float readOrDrainCoefficient) { + if (w.isRemote) + return null; // troublemakers go away + ChunkData chunkData = STORAGE.get(w, chunkX, chunkZ); if (chunkData.getVein() == null || chunkData.getFluid() == null) // nothing here... return null; //do stuff on it if needed @@ -102,7 +126,7 @@ public class GT_UndergroundOil { ChunkData chunkData = STORAGE.get(e.getChunk()); Fluid fluid = chunkData.getFluid(); if (fluid != null && fluid.getID() == e.getData().getInteger("GTOILFLUID")) - chunkData.setAmount(Math.min(0, Math.min(chunkData.getAmount(), e.getData().getInteger("GTOIL")))); + chunkData.setAmount(Math.min(chunkData.getAmount(), e.getData().getInteger("GTOIL"))); } } @@ -250,7 +274,7 @@ public class GT_UndergroundOil { public void changeAmount(int delta) { if (delta != 0) dirty = true; - this.amount = Math.max(0, amount - delta); + this.amount = Math.max(amount + delta, 0); } @Nullable @@ -272,7 +296,7 @@ public class GT_UndergroundOil { @Override public boolean isSameAsDefault() { - return dirty; + return !dirty; } } } diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java index 55743f445d..b59dd1d848 100644 --- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java +++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java @@ -30,10 +30,12 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; import java.util.List; -public class GT_Item_Machines extends ItemBlock { +public class GT_Item_Machines extends ItemBlock implements IFluidContainerItem { private static final String[] directionNames = {"Bottom", "Top", "North", "South", "West", "East"}; @@ -89,6 +91,15 @@ public class GT_Item_Machines extends ItemBlock { } aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(tTileEntity.getEUCapacity()) + EnumChatFormatting.GRAY); } + if (GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_QuantumTank || GregTech_API.METATILEENTITIES[tDamage] instanceof GT_MetaTileEntity_SuperTank) { + if (aStack.hasTagCompound() && aStack.stackTagCompound.hasKey("mFluid")) { + FluidStack tContents = FluidStack.loadFluidStackFromNBT(aStack.stackTagCompound.getCompoundTag("mFluid")); + if (tContents != null && tContents.amount > 0) { + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_TANK_INFO", "Contains Fluid: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tContents.getLocalizedName() + EnumChatFormatting.GRAY); + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_TANK_AMOUNT", "Fluid Amount: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + GT_Utility.formatNumbers(tContents.amount) + " L" + EnumChatFormatting.GRAY); + } + } + } } NBTTagCompound aNBT = aStack.getTagCompound(); if (aNBT != null) { @@ -240,4 +251,82 @@ public class GT_Item_Machines extends ItemBlock { } } } + + @Override + public FluidStack getFluid(ItemStack container) { + if (container != null) { + NBTTagCompound tNBT = container.stackTagCompound; + if (tNBT != null && tNBT.hasKey("mFluid", 10)) { + return FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("mFluid")); + } + } + return null; + } + + @Override + public int getCapacity(ItemStack container) { + if (container != null) { + int tDamage = container.getItemDamage(); + IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; + if (tMetaTile != null) + return tMetaTile.getCapacity(); + } + return 0; + } + + @Override + public int fill(ItemStack container, FluidStack resource, boolean doFill) { + if (container != null && resource != null) { + int tDamage = container.getItemDamage(); + IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; + if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { + return 0; + } + if (container.stackTagCompound == null) container.stackTagCompound = new NBTTagCompound(); + FluidStack tStoredFluid = getFluid(container); + int tCapacity = getCapacity(container); + if (tCapacity <= 0) return 0; + if (tStoredFluid != null && tStoredFluid.isFluidEqual(resource)) { + int tAmount = Math.min(tCapacity - tStoredFluid.amount, resource.amount); + if (doFill) { + FluidStack tNewFluid = new FluidStack(tStoredFluid, tAmount + tStoredFluid.amount); + container.stackTagCompound.setTag("mFluid", tNewFluid.writeToNBT(new NBTTagCompound())); + } + return tAmount; + } + if (tStoredFluid == null) { + int tAmount = Math.min(tCapacity, resource.amount); + if (doFill) { + FluidStack tNewFluid = new FluidStack(resource, tAmount); + container.stackTagCompound.setTag("mFluid", tNewFluid.writeToNBT(new NBTTagCompound())); + } + return tAmount; + } + } + return 0; + } + + @Override + public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { + if (container != null) { + int tDamage = container.getItemDamage(); + IMetaTileEntity tMetaTile = GregTech_API.METATILEENTITIES[tDamage]; + if (!(tMetaTile instanceof GT_MetaTileEntity_QuantumTank || tMetaTile instanceof GT_MetaTileEntity_SuperTank)) { + return null; + } + if (container.stackTagCompound == null) container.stackTagCompound = new NBTTagCompound(); + FluidStack tStoredFluid = getFluid(container); + if (tStoredFluid != null) { + int tAmount = Math.min(maxDrain, tStoredFluid.amount); + FluidStack tNewFluid = new FluidStack(tStoredFluid, tStoredFluid.amount - tAmount); + FluidStack tOutputFluid = new FluidStack(tStoredFluid, tAmount); + if (doDrain) { + if (tNewFluid.amount <= 0) container.stackTagCompound.removeTag("mFluid"); + else container.stackTagCompound.setTag("mFluid", tNewFluid.writeToNBT(new NBTTagCompound())); + } + return tOutputFluid; + } + } + return null; + } } diff --git a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java index 9cbdb2b832..4b7d294a25 100644 --- a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java +++ b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java @@ -33,6 +33,9 @@ public class GT_IntegratedCircuit_Item extends GT_Generic_Item { ItemList.Circuit_Integrated.set(this); + for (int i = 1; i <= 24; i++) { + GregTech_API.registerConfigurationCircuit(new ItemStack(this, 0, i)); + } GT_ModHandler.addShapelessCraftingRecipe(ItemList.Circuit_Integrated.getWithDamage(1L, 0L, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{OrePrefixes.circuit.get(Materials.Basic)}); long bits = GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE; diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java index e7f846d9b0..4501efb20c 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java @@ -58,10 +58,11 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { private static final String aTextStick = " S "; private static final String aTextFeather = "F "; private static final String aTextEmptyRow = " "; private static final String aTextShape = " P "; - private static final String PartCoverText = " L/sec (as Cover)"; + private static final String PartCoverText = " L/t ("; + private static final String PartCoverText2 = " L/s) as Cover"; private static final String PartNotCoverText = "Cannot be used as a Cover"; private static final String RAText = "Grabs from and inserts into specific slots"; - private static final String FRText1 = "Configuable up to "; + private static final String FRText1 = "Configurable up to "; private static final String FRText2 = " L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click"; public GT_MetaGenerated_Item_01() { @@ -541,16 +542,16 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_ModHandler.addCraftingRecipe(ItemList.Electric_Piston_EV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", 'P', OrePrefixes.plate.get(Materials.Titanium), 'S', OrePrefixes.stick.get(Materials.Titanium), 'G', OrePrefixes.gearGtSmall.get(Materials.Titanium), 'M', ItemList.Electric_Motor_EV, 'C', OrePrefixes.cableGt01.get(Materials.Aluminium)}); GT_ModHandler.addCraftingRecipe(ItemList.Electric_Piston_IV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", 'P', OrePrefixes.plate.get(Materials.TungstenSteel), 'S', OrePrefixes.stick.get(Materials.TungstenSteel), 'G', OrePrefixes.gearGtSmall.get(Materials.TungstenSteel), 'M', ItemList.Electric_Motor_IV, 'C', OrePrefixes.cableGt01.get(Materials.Tungsten)}); - ItemList.Electric_Pump_LV.set(addItem(610, "Electric Pump (LV)", GT_Utility.formatNumbers(640) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1L))); - ItemList.Electric_Pump_MV.set(addItem(611, "Electric Pump (MV)", GT_Utility.formatNumbers(2560) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 2L))); - ItemList.Electric_Pump_HV.set(addItem(612, "Electric Pump (HV)", GT_Utility.formatNumbers(10240) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L))); - ItemList.Electric_Pump_EV.set(addItem(613, "Electric Pump (EV)", GT_Utility.formatNumbers(40960) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 8L))); - ItemList.Electric_Pump_IV.set(addItem(614, "Electric Pump (IV)", GT_Utility.formatNumbers(163840) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 16L))); - ItemList.Electric_Pump_LuV.set(addItem(615, "Electric Pump (LuV)", GT_Utility.formatNumbers(655360) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 32L))); - ItemList.Electric_Pump_ZPM.set(addItem(616, "Electric Pump (ZPM)", GT_Utility.formatNumbers(2621440) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 64L))); - ItemList.Electric_Pump_UV.set(addItem(617, "Electric Pump (UV)", GT_Utility.formatNumbers(10485760) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 128L))); - ItemList.Electric_Pump_UHV.set(addItem(618, "Electric Pump (UHV)", GT_Utility.formatNumbers(20971520) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 256L))); - ItemList.Electric_Pump_UEV.set(addItem(619, "Electric Pump (UEV)", GT_Utility.formatNumbers(41943040) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 512L))); + ItemList.Electric_Pump_LV.set(addItem(610, "Electric Pump (LV)", GT_Utility.formatNumbers(32) + PartCoverText + GT_Utility.formatNumbers(32 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1L))); + ItemList.Electric_Pump_MV.set(addItem(611, "Electric Pump (MV)", GT_Utility.formatNumbers(128) + PartCoverText + GT_Utility.formatNumbers(128 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 2L))); + ItemList.Electric_Pump_HV.set(addItem(612, "Electric Pump (HV)", GT_Utility.formatNumbers(512) + PartCoverText + GT_Utility.formatNumbers(512 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L))); + ItemList.Electric_Pump_EV.set(addItem(613, "Electric Pump (EV)", GT_Utility.formatNumbers(2048) + PartCoverText + GT_Utility.formatNumbers(2048 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 8L))); + ItemList.Electric_Pump_IV.set(addItem(614, "Electric Pump (IV)", GT_Utility.formatNumbers(8192) + PartCoverText + GT_Utility.formatNumbers(8192 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 16L))); + ItemList.Electric_Pump_LuV.set(addItem(615, "Electric Pump (LuV)", GT_Utility.formatNumbers(32768) + PartCoverText + GT_Utility.formatNumbers(32768 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 32L))); + ItemList.Electric_Pump_ZPM.set(addItem(616, "Electric Pump (ZPM)", GT_Utility.formatNumbers(131072) + PartCoverText + GT_Utility.formatNumbers(131072 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 64L))); + ItemList.Electric_Pump_UV.set(addItem(617, "Electric Pump (UV)", GT_Utility.formatNumbers(524288) + PartCoverText + GT_Utility.formatNumbers(524288 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 128L))); + ItemList.Electric_Pump_UHV.set(addItem(618, "Electric Pump (UHV)", GT_Utility.formatNumbers(1048576) + PartCoverText + GT_Utility.formatNumbers(1048576 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 256L))); + ItemList.Electric_Pump_UEV.set(addItem(619, "Electric Pump (UEV)", GT_Utility.formatNumbers(2097152) + PartCoverText + GT_Utility.formatNumbers(2097152 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 512L))); ItemList.Electric_Pump_UIV.set(addItem(27, "Electric Pump (UIV)", PartNotCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 512L))); ItemList.Electric_Pump_UMV.set(addItem(28, "Electric Pump (UMV)", PartNotCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 512L))); ItemList.Electric_Pump_UXV.set(addItem(29, "Electric Pump (UXV)", PartNotCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 512L))); @@ -574,11 +575,11 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_ModHandler.addCraftingRecipe(ItemList.Electric_Pump_EV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", 'M', ItemList.Electric_Motor_EV, 'O', OrePrefixes.ring.get(Materials.AnyRubber), 'X', OrePrefixes.rotor.get(Materials.StainlessSteel), 'S', OrePrefixes.screw.get(Materials.StainlessSteel), 'W', OrePrefixes.cableGt01.get(Materials.Aluminium), 'P', OrePrefixes.pipeMedium.get(Materials.Titanium)}); GT_ModHandler.addCraftingRecipe(ItemList.Electric_Pump_IV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", 'M', ItemList.Electric_Motor_IV, 'O', OrePrefixes.ring.get(Materials.AnySyntheticRubber), 'X', OrePrefixes.rotor.get(Materials.TungstenSteel), 'S', OrePrefixes.screw.get(Materials.TungstenSteel), 'W', OrePrefixes.cableGt01.get(Materials.Tungsten), 'P', OrePrefixes.pipeMedium.get(Materials.TungstenSteel)}); - ItemList.Steam_Valve_LV.set(addItem(620, "Steam Valve (LV)", GT_Utility.formatNumbers(20480) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1L))); - ItemList.Steam_Valve_MV.set(addItem(621, "Steam Valve (MV)", GT_Utility.formatNumbers(40960) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 2L))); - ItemList.Steam_Valve_HV.set(addItem(622, "Steam Valve (HV)", GT_Utility.formatNumbers(81920) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L))); - ItemList.Steam_Valve_EV.set(addItem(623, "Steam Valve (EV)", GT_Utility.formatNumbers(163840) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 8L))); - ItemList.Steam_Valve_IV.set(addItem(624, "Steam Valve (IV)", GT_Utility.formatNumbers(327680) + PartCoverText, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 16L))); + ItemList.Steam_Valve_LV.set(addItem(620, "Steam Valve (LV)", GT_Utility.formatNumbers(1024) + PartCoverText + GT_Utility.formatNumbers(1024 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1L))); + ItemList.Steam_Valve_MV.set(addItem(621, "Steam Valve (MV)", GT_Utility.formatNumbers(2048) + PartCoverText + GT_Utility.formatNumbers(2048 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 2L))); + ItemList.Steam_Valve_HV.set(addItem(622, "Steam Valve (HV)", GT_Utility.formatNumbers(4096) + PartCoverText + GT_Utility.formatNumbers(4096 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L))); + ItemList.Steam_Valve_EV.set(addItem(623, "Steam Valve (EV)", GT_Utility.formatNumbers(8192) + PartCoverText + GT_Utility.formatNumbers(8192 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 8L))); + ItemList.Steam_Valve_IV.set(addItem(624, "Steam Valve (IV)", GT_Utility.formatNumbers(16384) + PartCoverText + GT_Utility.formatNumbers(16384 * 20) + PartCoverText2, new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 16L))); GregTech_API.registerCover(ItemList.Steam_Valve_LV.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(1024)); GregTech_API.registerCover(ItemList.Steam_Valve_MV.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(2048)); diff --git a/src/main/java/gregtech/common/render/GT_PollutionRenderer.java b/src/main/java/gregtech/common/render/GT_PollutionRenderer.java index 4353786a7b..5128af1c36 100644 --- a/src/main/java/gregtech/common/render/GT_PollutionRenderer.java +++ b/src/main/java/gregtech/common/render/GT_PollutionRenderer.java @@ -6,6 +6,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GT_Mod; import gregtech.common.entities.GT_EntityFXPollution; import gregtech.common.misc.GT_ClientPollutionMap; import net.minecraft.block.Block; @@ -100,6 +101,10 @@ public class GT_PollutionRenderer { return color(oColor, pollutionMap.getPollution(x, z)/1000, 300, 500, foliageColor); } + public static int getKnownPollution(int x, int z) { + return pollutionMap.getPollution(x, z); + } + @SubscribeEvent(priority = EventPriority.LOW) public void manipulateColor(EntityViewRenderEvent.FogColors event) { if (!DEBUG && Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) @@ -122,6 +127,8 @@ public class GT_PollutionRenderer { @SubscribeEvent(priority = EventPriority.LOWEST) public void renderGTPollutionFog(EntityViewRenderEvent.RenderFogEvent event) { + if (!GT_Mod.gregtechproxy.mRenderPollutionFog) return; + if ((!DEBUG && Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) || (fogIntensityLastTick <= 0 && fogIntensityLastTick >= FOG_START_EXP_RATIO)) return; @@ -138,6 +145,8 @@ public class GT_PollutionRenderer { @SubscribeEvent(priority = EventPriority.LOWEST) public void renderGTPollutionFog(EntityViewRenderEvent.FogDensity event) { + if (!GT_Mod.gregtechproxy.mRenderPollutionFog) return; + if (!DEBUG && Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) return; @@ -194,6 +203,7 @@ public class GT_PollutionRenderer { // Adding dirt particles in the air @SubscribeEvent(priority = EventPriority.HIGHEST) public void onClientTick(TickEvent.ClientTickEvent event) { + if (!GT_Mod.gregtechproxy.mRenderDirtParticles) return; Minecraft mc = Minecraft.getMinecraft(); if (mc == null) return; diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index 41620dd711..3927241e79 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.boilers; +import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; @@ -30,7 +31,7 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { super(aID, aName, aNameRegional, new String[]{ "An early way to get Steam Power", "Produces 120L of Steam per second", - "Causes 20 Pollution per second"}); + "Causes "+Integer.toString(GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond)+" Pollution per second"}); } public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional, String[] aDescription) { @@ -99,7 +100,7 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { @Override protected int getPollution() { - return 20; + return GT_Mod.gregtechproxy.mPollutionSmallCoalBoilerPerSecond; } @Override diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java index aeb0a66173..18010c0886 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.boilers; +import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; @@ -28,13 +29,12 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public static final int ENERGY_PER_LAVA = 1; public static final int CONSUMPTION_PER_HEATUP = 3; public static final int PRODUCTION_PER_SECOND = 600; - public static final int POLLUTION_PER_SECOND = 20; public GT_MetaTileEntity_Boiler_Lava(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, new String[]{ "A Boiler running off Lava", "Produces " + PRODUCTION_PER_SECOND + "L of Steam per second", - "Causes " + POLLUTION_PER_SECOND + " Pollution per second", + "Causes " + Integer.toString(GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond) + " Pollution per second", "Consumes " + ((double) CONSUMPTION_PER_HEATUP / ENERGY_PER_LAVA) + "L of Lava every " + COOLDOWN_INTERVAL + " ticks when fully heat up"}); } @@ -98,7 +98,7 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { @Override protected int getPollution() { - return POLLUTION_PER_SECOND; + return GT_Mod.gregtechproxy.mPollutionHighPressureLavaBoilerPerSecond; } @Override diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java index ab51156868..98546ff09e 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.boilers; +import gregtech.GT_Mod; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -24,7 +25,7 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bro super(aID, aName, aNameRegional, new String[]{ "Faster than the Bronze Boiler", "Produces 300L of Steam per second", - "Causes 30 Pollution per second"}); + "Causes "+Integer.toString(GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond)+" Pollution per second"}); } public GT_MetaTileEntity_Boiler_Steel(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -81,7 +82,7 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bro @Override protected int getPollution() { - return 30; + return GT_Mod.gregtechproxy.mPollutionHighPressureCoalBoilerPerSecond; } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java index 606af204e9..f025ed34ec 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java @@ -1,6 +1,7 @@ package gregtech.common.tileentities.generators; import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; @@ -19,14 +20,14 @@ import static gregtech.api.enums.Textures.BlockIcons.*; public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGenerator { - public static final int BASE_POLLUTION = 2; + public int mEfficiency; public GT_MetaTileEntity_DieselGenerator(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, new String[]{ "Requires liquid Fuel", - "Causes " + (int) (20 * BASE_POLLUTION * Math.pow(2, aTier - 1)) + " Pollution per second"}); + "Causes " + (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[aTier]) + " Pollution per second"}); onConfigLoad(); } @@ -165,6 +166,6 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe @Override public int getPollution() { - return (int) (BASE_POLLUTION * Math.pow(2, mTier - 1)); + return (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[mTier]); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java index 02b42e2b2f..a0f6aeee64 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.generators; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.interfaces.ITexture; @@ -12,14 +13,14 @@ import gregtech.api.util.GT_Recipe; import static gregtech.api.enums.Textures.BlockIcons.*; public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerator { - public static final int BASE_POLLUTION = 1; + public int mEfficiency; public GT_MetaTileEntity_GasTurbine(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, new String[]{ "Requires flammable Gasses", - "Causes " + (int) (20 * BASE_POLLUTION * Math.pow(2, aTier - 1)) + " Pollution per second"}); + "Causes " + (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[aTier]) + " Pollution per second"}); onConfigLoad(); } @@ -137,6 +138,6 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat @Override public int getPollution() { - return (int) (BASE_POLLUTION * Math.pow(2, mTier - 1)); + return (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[mTier]); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index 5516b355fd..04dcdbe6b1 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -72,6 +72,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B private static int sEnergyPerEssentia = 320; private static final Map<Aspect, Integer> sAspectsEnergy = new HashMap<>(); private static int sDragonEggEnergyPerTick = 2048; + private static int sCreeperEggEnergyPerTick = 512; private int mEfficiency; private int mMaxVisPerDrain; private final MagicalEnergyBB mMagicalEnergyBB = new MagicalEnergyBB(this, mTier, mTier + 2); @@ -96,6 +97,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B private static void sharedConfigLoad(GT_Config aConfig) { sAllowMultipleEggs = aConfig.get(machineconfig, "MagicEnergyAbsorber.AllowMultipleEggs", false); sDragonEggEnergyPerTick = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerTick.DragonEgg", 2048); + sCreeperEggEnergyPerTick = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerTick.CreeperEgg", 512); sEnergyPerEndercrystal = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerTick.EnderCrystal", 512); if (THAUMCRAFT_LOADED) { sEnergyFromVis = aConfig.get(machineconfig, "MagicEnergyAbsorber.EnergyPerVis", 20); @@ -422,7 +424,13 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B setActiveSiphon(this); } } - return sDragonEggEnergyPerTick; + Block egg = getBaseMetaTileEntity().getBlockOffset(0, 1, 0); + if (egg == Blocks.dragon_egg) { + return sDragonEggEnergyPerTick; + } else if (egg.getUnlocalizedName().contains("creeperEgg")) { + return sCreeperEggEnergyPerTick; + } + return 0; } private long absorbFromEnderCrystals() { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index 42c8db6722..b6ff782cfb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -95,7 +95,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic }else if(aStack.getItem() == Ic2Items.dynamite.getItem()){ aStack.stackSize -= 4; }else if(aStack.getItem() == ItemList.Block_Powderbarrel.getItem() && aStack.getItemDamage()==ItemList.Block_Powderbarrel.get(1).getItemDamage()){ - aStack.stackSize -=8; + aStack.stackSize -= 8; }else{ aStack.stackSize -= 1; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java index 2409c1660c..af6afbc4c4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AbstractMultiFurnace.java @@ -35,11 +35,6 @@ public abstract class GT_MetaTileEntity_AbstractMultiFurnace<T extends GT_MetaTi } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 20; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index c2460213c8..ac152ac09d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -385,11 +385,6 @@ public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_EnhancedMu } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java index 446965f3b6..617c191562 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; @@ -34,7 +35,7 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri .addInfo("Controller Block for the Bricked Blast Furnace") .addInfo("Usable for Steel and general Pyrometallurgy") .addInfo("Has a useful interface, unlike other gregtech multis") - .addPollutionAmount(200) + .addPollutionAmount(GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond) .addSeparator() .beginStructureBlock(3, 4, 3, true) .addController("Front center") diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java index 058d5f3487..d4126cf74c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; @@ -69,7 +70,9 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock mEfficiency = 10000; mEfficiencyIncrease = 10000; mMaxProgresstime = Math.max(1, mMaxProgresstime); - GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime * 10); + + //adds all the pollution at once when the recipe starts + GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime * getPollutionPerTick(null)); return true; } else { mEfficiency = 0; @@ -199,8 +202,8 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; + public int getPollutionPerSecond(ItemStack aStack) { + return GT_Mod.gregtechproxy.mPollutionCharcoalPitPerSecond; } @Override @@ -230,7 +233,7 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock .addInfo("Controller for the Charcoal Pit") .addInfo("Converts Logs into Brittle Charcoal blocks") .addInfo("Will automatically start when valid") - .addPollutionAmount(100) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginVariableStructureBlock(3, 11, 3, 6, 3, 11, false) .addStructureInfo("Can be up to 11x6x11 in size, shape doesn't matter") diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index e58ec25bd0..1edcad540d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -352,11 +352,6 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index c6a30ad085..d26a29652f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -2,6 +2,7 @@ package gregtech.common.tileentities.machines.multi; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -78,7 +79,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu .addInfo("Default: Produces 2048EU/t at 100% fuel efficiency") .addInfo("Boosted: Produces 6144EU/t at 150% fuel efficiency") .addInfo("You need to wait for it to reach 300% to output full power") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 3, 4, false) .addController("Front center") @@ -264,10 +265,10 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_EnhancedMu } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 24; + public int getPollutionPerSecond(ItemStack aStack) { + return GT_Mod.gregtechproxy.mPollutionLargeCombustionEnginePerSecond; } - + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return true; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index fe68b13152..f83f6aa11d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -250,11 +250,6 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Enhan } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index 010d1558be..408b2441fc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -429,11 +429,6 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_En } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index 43498a59fe..3acf59b93e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -3,6 +3,7 @@ package gregtech.common.tileentities.machines.multi; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.Materials; @@ -18,7 +19,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_StructureUtility; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -88,7 +88,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab .addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal") .addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%") .addInfo("Additionally gives +100K for every tier past MV") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 4, 3, true) .addController("Front bottom") @@ -129,6 +129,11 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab } @Override + public int getPollutionPerSecond(ItemStack aStack){ + return GT_Mod.gregtechproxy.mPollutionEBFPerSecond; + } + + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sBlastRecipes; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java index 8c3d474b8b..4d978ecc6e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -44,7 +45,7 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die .addInfo("Default: Produces 8192EU/t at 100% fuel efficiency") .addInfo("Boosted: Produces 32768EU/t at 400% fuel efficiency") .addInfo("You need to wait for it to reach 400% to output full power") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 3, 4, false) .addController("Front center") @@ -158,8 +159,8 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die } @Override - public int getPollutionPerTick(ItemStack aStack) { - return super.getPollutionPerTick(aStack) * 8; + public int getPollutionPerSecond(ItemStack aStack) { + return GT_Mod.gregtechproxy.mPollutionExtremeCombustionEnginePerSecond; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index 3536030fe0..be605e9249 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -431,11 +431,6 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java index fa96971a07..18dfb32351 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java @@ -276,11 +276,6 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_EnhancedM } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index b71d01ec07..b6ee628f2e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -1,6 +1,7 @@ package gregtech.common.tileentities.machines.multi; import com.gtnewhorizon.structurelib.structure.IStructureElement; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; @@ -45,7 +46,7 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Cub tt.addMachineType("Implosion Compressor") .addInfo("Explosions are fun") .addInfo("Controller block for the Implosion Compressor") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 3, 3, true) .addController("Front center") @@ -163,10 +164,9 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Cub } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 500; + public int getPollutionPerSecond(ItemStack aStack){ + return GT_Mod.gregtechproxy.mPollutionImplosionCompressorPerSecond; } - @Override public int getDamageToComponent(ItemStack aStack) { return 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index 2599d238a9..c9b2c6d467 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -73,6 +73,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En private int excessProjectedEU = 0; //Eliminate rounding errors from throttling the boiler private int mCasingAmount; private int mFireboxAmount; + protected int pollutionPerSecond = 1; //placeholder for the child classes public GT_MetaTileEntity_LargeBoiler(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -90,7 +91,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En .addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s")//? .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)") .addInfo(String.format("Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()))//? check semifluid again - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 5, 3, false) .addController("Front bottom") @@ -132,6 +133,16 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En public abstract int getEfficiencyIncrease(); + public int getIntegratedCircuitConfig(){ + return integratedCircuitConfig; + } + + @Override + public int getPollutionPerSecond(ItemStack aStack) { + //allows for 0 pollution if circuit throttle is too high + return Math.max(0, (int) (pollutionPerSecond * (1-GT_Mod.gregtechproxy.mPollutionReleasedByThrottle*getIntegratedCircuitConfig()))); + } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { @@ -301,12 +312,6 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_En } @Override - public int getPollutionPerTick(ItemStack aStack) { - int adjustedEUOutput = Math.max(25, getEUt() - 25 * integratedCircuitConfig); - return Math.max(1, 12 * adjustedEUOutput / getEUt()); - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java index 9aeff9b3d0..fda98a431f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Bronze.java @@ -1,24 +1,29 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_Bronze extends GT_MetaTileEntity_LargeBoiler { + public GT_MetaTileEntity_LargeBoiler_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeBronzeBoilerPerSecond; } public GT_MetaTileEntity_LargeBoiler_Bronze(String aName) { super(aName); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeBronzeBoilerPerSecond; } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_Bronze(this.mName); } - + @Override public String getCasingMaterial(){ return "Bronze"; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java index d1188955f4..583f26082c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Steel.java @@ -1,24 +1,28 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_Steel extends GT_MetaTileEntity_LargeBoiler { public GT_MetaTileEntity_LargeBoiler_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeSteelBoilerPerSecond; } public GT_MetaTileEntity_LargeBoiler_Steel(String aName) { super(aName); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeSteelBoilerPerSecond; } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_Steel(this.mName); } - + @Override public String getCasingMaterial(){ return "Steel"; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java index e67cf64723..01f59d1f99 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java @@ -1,24 +1,28 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_Titanium extends GT_MetaTileEntity_LargeBoiler { public GT_MetaTileEntity_LargeBoiler_Titanium(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond; } public GT_MetaTileEntity_LargeBoiler_Titanium(String aName) { super(aName); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeTitaniumBoilerPerSecond; } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_Titanium(this.mName); } - + @Override public String getCasingMaterial(){ return "Titanium"; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java index 78e7d25752..b14ce3e5f0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_TungstenSteel.java @@ -1,24 +1,28 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_LargeBoiler_TungstenSteel extends GT_MetaTileEntity_LargeBoiler { public GT_MetaTileEntity_LargeBoiler_TungstenSteel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond; } public GT_MetaTileEntity_LargeBoiler_TungstenSteel(String aName) { super(aName); + pollutionPerSecond = GT_Mod.gregtechproxy.mPollutionLargeTungstenSteelBoilerPerSecond; } @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_LargeBoiler_TungstenSteel(this.mName); } - + @Override public String getCasingMaterial(){ return "TungstenSteel"; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java index 87eddb7e13..97695ac2b8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java @@ -246,11 +246,6 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_En } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java index 20f795572e..ca2ecbbbc1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -41,7 +42,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT tt.addMachineType("Gas Turbine") .addInfo("Controller block for the Large Gas Turbine") .addInfo("Needs a Turbine, place inside controller") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 3, 4, true) .addController("Front center") @@ -82,8 +83,8 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 15; + public int getPollutionPerSecond(ItemStack aStack) { + return GT_Mod.gregtechproxy.mPollutionLargeGasTurbinePerSecond; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java index 2c803712f1..b34662e619 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -83,11 +83,6 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) { if (looseFit) { aOptFlow *= 4; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index 76c5533c09..b32385c1be 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -89,11 +89,6 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) { if (aFluids.size() >= 1) { aOptFlow *= 800;//CHANGED THINGS HERE, check recipe runs once per 20 ticks diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java index 356dda9183..651d9c9d09 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java @@ -85,11 +85,6 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg return 16; } - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - private int condenseSteam(int steam) { excessWater += steam; int water = excessWater / STEAM_PER_WATER; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java index 37f56deef5..cd07476194 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java @@ -3,6 +3,7 @@ package gregtech.common.tileentities.machines.multi; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -74,7 +75,7 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu .addInfo("Controller Block for the Multi Smelter") .addInfo("Smelts up to 8-128 items at once") .addInfo("Items smelted increases with coil tier") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(3, 3, 3, true) .addController("Front bottom") @@ -113,6 +114,11 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu } @Override + public int getPollutionPerSecond(ItemStack aStack){ + return GT_Mod.gregtechproxy.mPollutionMultiSmelterPerSecond; + } + + @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); if (tInputList.isEmpty()) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java index b9ade288c1..10b94fc254 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java @@ -273,11 +273,6 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_EnhancedMult } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java index 61fb394841..84d200d4f9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PrimitiveBlastFurnace.java @@ -234,7 +234,7 @@ public abstract class GT_MetaTileEntity_PrimitiveBlastFurnace extends MetaTileEn GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), - 200); + GT_Mod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond); } aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index a48f63c60a..44f93eb3db 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -410,11 +410,6 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_CubicMu } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index 9542c54ce0..18eda558a0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -4,6 +4,7 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import cpw.mods.fml.common.Loader; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.Textures; @@ -91,7 +92,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu .addInfo("Processing speed scales linearly with Coil tier:") .addInfo("CuNi: 50%, FeAlCr: 100%, Ni4Cr: 150%, Fe50CW: 200%, etc.") .addInfo("EU/t is not affected by Coil tier") - .addPollutionAmount(20 * getPollutionPerTick(null)) + .addPollutionAmount(getPollutionPerSecond(null)) .addSeparator() .beginStructureBlock(5, 4, 5, true) .addController("Front center") @@ -225,8 +226,8 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_EnhancedMu } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 30; + public int getPollutionPerSecond(ItemStack aStack) { + return GT_Mod.gregtechproxy.mPollutionPyrolyseOvenPerSecond; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java index 843f2ff337..f476e78310 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java @@ -143,11 +143,6 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_CubicMult } @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override public int getDamageToComponent(ItemStack aStack) { return 0; } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java index fd500b258a..a7c3a524b8 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCrushedOre.java @@ -22,7 +22,7 @@ public class ProcessingCrushedOre implements gregtech.api.interfaces.IOreRecipeR GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, GT_Utility.selectItemInList(2, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L), 10, false); break; case crushedPurified: - GT_ModHandler.addThermalCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), (int) Math.min(5000L, Math.abs(aMaterial.getMass() * 20L)), GT_OreDictUnificator.get(OrePrefixes.crushedCentrifuged, aMaterial.mMacerateInto, GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L), 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, GT_Utility.selectItemInList(1, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L)); + GT_ModHandler.addThermalCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), new int[] {10000, 1111}, (int) Math.min(5000L, Math.abs(aMaterial.getMass() * 20L)), GT_OreDictUnificator.get(OrePrefixes.crushedCentrifuged, aMaterial.mMacerateInto, GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L), 1L), GT_OreDictUnificator.get(OrePrefixes.dust, GT_Utility.selectItemInList(1, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L)); ItemStack tGem = GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L); if(tGem!=null){ diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDirty.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDirty.java index ca73118d20..2682cf24a2 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDirty.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDirty.java @@ -21,8 +21,8 @@ public class ProcessingDirty implements gregtech.api.interfaces.IOreRecipeRegist public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, net.minecraft.item.ItemStack aStack) { GT_Values.RA.addForgeHammerRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial.mMacerateInto, 1L), 10, 16); GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial.mMacerateInto, GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L), 1L), GT_OreDictUnificator.get(OrePrefixes.dust, GT_Utility.selectItemInList(0, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L), 10, false); - GT_ModHandler.addOreWasherRecipe(GT_Utility.copyAmount(1L, aStack), 1000, GT_OreDictUnificator.get(aPrefix == OrePrefixes.crushed ? OrePrefixes.crushedPurified : OrePrefixes.dustPure, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, GT_Utility.selectItemInList(0, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); - GT_ModHandler.addThermalCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), (int) Math.min(5000L, Math.abs(aMaterial.getMass() * 20L)), GT_OreDictUnificator.get(aPrefix == OrePrefixes.crushed ? OrePrefixes.crushedCentrifuged : OrePrefixes.dust, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, GT_Utility.selectItemInList(1, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); + GT_ModHandler.addOreWasherRecipe(GT_Utility.copyAmount(1L, aStack), new int[] {10000, 1111, 10000}, 1000, GT_OreDictUnificator.get(aPrefix == OrePrefixes.crushed ? OrePrefixes.crushedPurified : OrePrefixes.dustPure, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, GT_Utility.selectItemInList(0, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); + GT_ModHandler.addThermalCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), new int[] {10000, 1111, 10000}, (int) Math.min(5000L, Math.abs(aMaterial.getMass() * 20L)), GT_OreDictUnificator.get(aPrefix == OrePrefixes.crushed ? OrePrefixes.crushedCentrifuged : OrePrefixes.dust, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, GT_Utility.selectItemInList(1, aMaterial.mMacerateInto, aMaterial.mOreByProducts), 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L)); if (aMaterial.contains(SubTag.WASHING_MERCURY)) GT_Values.RA.addChemicalBathRecipe(GT_Utility.copyAmount(1L, aStack), Materials.Mercury.getFluid(1000L), GT_OreDictUnificator.get(aPrefix == OrePrefixes.crushed ? OrePrefixes.crushedPurified : OrePrefixes.dustPure, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial.mMacerateInto, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), new int[]{10000, 7000, 4000}, 800, 8); diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java index 9fa2c63970..29a89ccc65 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingDust.java @@ -191,7 +191,7 @@ public class ProcessingDust implements gregtech.api.interfaces.IOreRecipeRegistr GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(2L, aStack), 0, GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 2L), tImpureStack, null, null, null, null, (int) Math.max(1L, aMaterial.getMass() * 16L)); } } else { - GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), 0, GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), tImpureStack, null, null, null, null, (int) Math.max(1L, aMaterial.getMass() * 8L)); + GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, aStack), null, null, null, GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, tByProduct, GT_OreDictUnificator.get(OrePrefixes.nugget, tByProduct, 1L), 1L), null, null, null, null, new int[]{10000, 1111}, (int) Math.max(1L, aMaterial.getMass() * 8L), 5); } break; case dustSmall: |