diff options
| author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-10-21 21:21:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-21 19:21:33 +0000 |
| commit | 901cb0d294b0c4f114bb247fbd7d6f97e7484f3c (patch) | |
| tree | fd4900d59f98ec34c9119c2003f79f7467abddf0 /src/main/java/gregtech | |
| parent | e741976ea6a6fa5dbcb45813fd1e2ca368331ba5 (diff) | |
| download | GT5-Unofficial-901cb0d294b0c4f114bb247fbd7d6f97e7484f3c.tar.gz GT5-Unofficial-901cb0d294b0c4f114bb247fbd7d6f97e7484f3c.tar.bz2 GT5-Unofficial-901cb0d294b0c4f114bb247fbd7d6f97e7484f3c.zip | |
Import pollution mixins from hodgepodge (#3395)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: boubou19 <miisterunknown@gmail.com>
Diffstat (limited to 'src/main/java/gregtech')
28 files changed, 779 insertions, 178 deletions
diff --git a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java index e9364f922b..3d6a33fe7f 100644 --- a/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java +++ b/src/main/java/gregtech/api/graphs/consumers/NodeEnergyReceiver.java @@ -14,7 +14,7 @@ import gregtech.api.enums.GTValues; import gregtech.api.enums.SoundResource; import gregtech.api.util.GTUtility; import gregtech.api.util.WorldSpawnedEventBuilder; -import gregtech.common.Pollution; +import gregtech.common.pollution.Pollution; // consumer for RF machines public class NodeEnergyReceiver extends ConsumerNode { diff --git a/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java b/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java index b26c7035c7..c7c488ccbd 100644 --- a/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java +++ b/src/main/java/gregtech/api/interfaces/ICleanroomReceiver.java @@ -4,7 +4,7 @@ import javax.annotation.Nullable; import net.minecraft.tileentity.TileEntity; -import gregtech.common.Pollution; +import gregtech.common.pollution.Pollution; /** * Implement this interface for TileEntities that can have association to cleanroom. diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index e39f78cee0..da81e7d9cb 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -83,8 +83,8 @@ import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTUtility; import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; -import gregtech.common.Pollution; import gregtech.common.covers.CoverInfo; +import gregtech.common.pollution.Pollution; import ic2.api.Direction; import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java index 963acf191f..8ab0da4349 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEBasicGenerator.java @@ -22,7 +22,7 @@ import gregtech.api.recipe.maps.FuelBackend; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; -import gregtech.common.Pollution; +import gregtech.common.pollution.Pollution; public abstract class MTEBasicGenerator extends MTEBasicTank implements RecipeMapWorkable { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java index 179ba56254..576389de80 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEHatchMuffler.java @@ -18,7 +18,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTLanguageManager; import gregtech.api.util.WorldSpawnedEventBuilder; -import gregtech.common.Pollution; +import gregtech.common.pollution.Pollution; @SuppressWarnings("unused") // Unused API is expected within scope public class MTEHatchMuffler extends MTEHatch { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java index 363c45bfc9..ce508433ec 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEMultiBlockBase.java @@ -95,11 +95,11 @@ import gregtech.api.util.VoidProtectionHelper; import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.client.GTSoundLoop; -import gregtech.common.Pollution; import gregtech.common.config.MachineStats; import gregtech.common.gui.modularui.widget.CheckRecipeResultSyncer; import gregtech.common.gui.modularui.widget.ShutDownReasonSyncer; import gregtech.common.items.MetaGeneratedTool01; +import gregtech.common.pollution.Pollution; import gregtech.common.tileentities.machines.IDualInputHatch; import gregtech.common.tileentities.machines.IDualInputInventory; import gregtech.common.tileentities.machines.IRecipeProcessingAwareHatch; diff --git a/src/main/java/gregtech/api/task/tasks/PollutionTask.java b/src/main/java/gregtech/api/task/tasks/PollutionTask.java index 3770409fb1..c8c9705e6c 100644 --- a/src/main/java/gregtech/api/task/tasks/PollutionTask.java +++ b/src/main/java/gregtech/api/task/tasks/PollutionTask.java @@ -8,7 +8,7 @@ import gregtech.api.enums.TickTime; import gregtech.api.interfaces.tileentity.IMachineProgress; import gregtech.api.task.TaskHost; import gregtech.api.task.TickableTask; -import gregtech.common.Pollution; +import gregtech.common.pollution.Pollution; public class PollutionTask<T extends TaskHost & IMachineProgress> extends TickableTask<T> { diff --git a/src/main/java/gregtech/api/util/GTUtility.java b/src/main/java/gregtech/api/util/GTUtility.java index 83cd5ced7a..da805f995d 100644 --- a/src/main/java/gregtech/api/util/GTUtility.java +++ b/src/main/java/gregtech/api/util/GTUtility.java @@ -167,8 +167,8 @@ import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeMaps; import gregtech.api.threads.RunnableSound; import gregtech.api.util.extensions.ArrayExt; -import gregtech.common.Pollution; import gregtech.common.blocks.BlockOresAbstract; +import gregtech.common.pollution.Pollution; import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.RecipeInputOreDict; diff --git a/src/main/java/gregtech/asm/GTCorePlugin.java b/src/main/java/gregtech/asm/GTCorePlugin.java index 3b8aa08d16..f8dde28c58 100644 --- a/src/main/java/gregtech/asm/GTCorePlugin.java +++ b/src/main/java/gregtech/asm/GTCorePlugin.java @@ -10,6 +10,7 @@ import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader; import bartworks.common.configs.Configuration; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; +import gregtech.common.pollution.PollutionConfig; import gregtech.mixin.Mixin; import gtPlusPlus.core.config.ASMConfiguration; @@ -20,8 +21,9 @@ public class GTCorePlugin implements IFMLLoadingPlugin, IEarlyMixinLoader { static { try { - ConfigurationManager.registerConfig(Configuration.class); ConfigurationManager.registerConfig(ASMConfiguration.class); + ConfigurationManager.registerConfig(Configuration.class); + ConfigurationManager.registerConfig(PollutionConfig.class); } catch (ConfigException e) { throw new RuntimeException(e); } diff --git a/src/main/java/gregtech/client/GTGUIClientConfig.java b/src/main/java/gregtech/client/GTGUIClientConfig.java index cf063acf55..875e62f7f8 100644 --- a/src/main/java/gregtech/client/GTGUIClientConfig.java +++ b/src/main/java/gregtech/client/GTGUIClientConfig.java @@ -11,6 +11,7 @@ import gregtech.common.config.Client; import gregtech.common.config.Gregtech; import gregtech.common.config.MachineStats; import gregtech.common.config.Worldgen; +import gregtech.common.pollution.PollutionConfig; public class GTGUIClientConfig extends SimpleGuiConfig { @@ -23,6 +24,7 @@ public class GTGUIClientConfig extends SimpleGuiConfig { Client.class, Gregtech.class, MachineStats.class, + PollutionConfig.class, Worldgen.class); } } diff --git a/src/main/java/gregtech/common/GTClient.java b/src/main/java/gregtech/common/GTClient.java index 844731e82f..7cd673c001 100644 --- a/src/main/java/gregtech/common/GTClient.java +++ b/src/main/java/gregtech/common/GTClient.java @@ -92,6 +92,8 @@ import gregtech.client.GTMouseEventHandler; import gregtech.client.SeekingOggCodec; import gregtech.common.blocks.BlockFrameBox; import gregtech.common.blocks.ItemMachines; +import gregtech.common.pollution.Pollution; +import gregtech.common.pollution.PollutionRenderer; import gregtech.common.render.BlackholeRenderer; import gregtech.common.render.DroneRender; import gregtech.common.render.FlaskRenderer; @@ -101,7 +103,6 @@ import gregtech.common.render.GTRendererBlock; import gregtech.common.render.LaserRenderer; import gregtech.common.render.MetaGeneratedToolRenderer; import gregtech.common.render.MultiTileRenderer; -import gregtech.common.render.PollutionRenderer; import gregtech.common.render.WormholeRenderer; import gregtech.common.render.items.DataStickRenderer; import gregtech.common.render.items.InfiniteSprayCanRenderer; @@ -670,6 +671,7 @@ public class GTClient extends GTProxy implements Runnable { .forEach(CoverBehaviorBase::reloadColorOverride); } }); + Pollution.onPostInitClient(); } @Override diff --git a/src/main/java/gregtech/common/GTProxy.java b/src/main/java/gregtech/common/GTProxy.java index 643811234d..e7cb627c91 100644 --- a/src/main/java/gregtech/common/GTProxy.java +++ b/src/main/java/gregtech/common/GTProxy.java @@ -167,6 +167,7 @@ import gregtech.common.items.MetaGeneratedTool01; import gregtech.common.misc.GlobalEnergyWorldSavedData; import gregtech.common.misc.GlobalMetricsCoverDatabase; import gregtech.common.misc.spaceprojects.SpaceProjectWorldSavedData; +import gregtech.common.pollution.Pollution; import gregtech.common.tileentities.machines.multi.drone.MTEDroneCentre; import gregtech.nei.GTNEIDefaultHandler; diff --git a/src/main/java/gregtech/common/config/Gregtech.java b/src/main/java/gregtech/common/config/Gregtech.java index a293b6cba7..e852a6b022 100644 --- a/src/main/java/gregtech/common/config/Gregtech.java +++ b/src/main/java/gregtech/common/config/Gregtech.java @@ -27,9 +27,6 @@ public class Gregtech { @Config.Comment("Ore drop behavior section") public static final OreDropBehavior oreDropBehavior = new OreDropBehavior(); - @Config.Comment("Pollution section") - public static final Pollution pollution = new Pollution(); - @Config.LangKey("GT5U.gui.config.gregtech.debug") public static class Debug { @@ -558,128 +555,4 @@ public class Gregtech { @Config.RequiresMcRestart public GTProxy.OreDropSystem setting = GTProxy.OreDropSystem.FortuneItem; } - - @Config.LangKey("GT5U.gui.config.gregtech.pollution") - public static class Pollution { - - @Config.Comment("if true, enables pollution in the game.") - @Config.DefaultBoolean(true) - @Config.RequiresMcRestart - public boolean pollution; - - @Config.Comment("Controls the threshold starting from which you can see fog.") - @Config.DefaultInt(550_000) - @Config.RequiresMcRestart - public int pollutionSmogLimit; - @Config.Comment("Controls the threshold starting from which players get poison effect.") - @Config.DefaultInt(750_000) - @Config.RequiresMcRestart - public int pollutionPoisonLimit; - @Config.Comment("Controls the threshold starting from which vegetation starts to be killed.") - @Config.DefaultInt(1_000_000) - @Config.RequiresMcRestart - public int pollutionVegetationLimit; - @Config.Comment("Controls the threshold starting from which if it rains, will turn cobblestone into gravel and gravel into sand.") - @Config.DefaultInt(2_000_000) - @Config.RequiresMcRestart - public int pollutionSourRainLimit; - @Config.Comment("Controls the pollution released by an explosion.") - @Config.DefaultInt(100_000) - @Config.RequiresMcRestart - public int pollutionOnExplosion; - @Config.Comment("Controls the pollution released per second by the bricked blast furnace.") - @Config.DefaultInt(200) - @Config.RequiresMcRestart - public int pollutionPrimitveBlastFurnacePerSecond; - @Config.Comment("Controls the pollution released per second by the charcoal pile igniter.") - @Config.DefaultInt(100) - @Config.RequiresMcRestart - public int pollutionCharcoalPitPerSecond; - @Config.Comment("Controls the pollution released per second by the EBF.") - @Config.DefaultInt(400) - @Config.RequiresMcRestart - public int pollutionEBFPerSecond; - @Config.Comment("Controls the pollution released per second by the large combustion engine.") - @Config.DefaultInt(480) - @Config.RequiresMcRestart - public int pollutionLargeCombustionEnginePerSecond; - @Config.Comment("Controls the pollution released per second by the extreme combustion engine.") - @Config.DefaultInt(3_840) - @Config.RequiresMcRestart - public int pollutionExtremeCombustionEnginePerSecond; - @Config.Comment("Controls the pollution released per second by the implosion compressor.") - @Config.DefaultInt(10_000) - @Config.RequiresMcRestart - public int pollutionImplosionCompressorPerSecond; - @Config.Comment("Controls the pollution released per second by the large bronze boiler.") - @Config.DefaultInt(1_000) - @Config.RequiresMcRestart - public int pollutionLargeBronzeBoilerPerSecond; - @Config.Comment("Controls the pollution released per second by the large steel boiler.") - @Config.DefaultInt(2_000) - @Config.RequiresMcRestart - public int pollutionLargeSteelBoilerPerSecond; - @Config.Comment("Controls the pollution released per second by the large titanium boiler.") - @Config.DefaultInt(3_000) - @Config.RequiresMcRestart - public int pollutionLargeTitaniumBoilerPerSecond; - @Config.Comment("Controls the pollution released per second by the large tungstensteel boiler.") - @Config.DefaultInt(4_000) - @Config.RequiresMcRestart - public int pollutionLargeTungstenSteelBoilerPerSecond; - @Config.Comment("Controls the pollution reduction obtained with each increment of the circuit when throttling large boilers.") - @Config.DefaultFloat(1.0f / 24.0f) // divided by 24 because there are 24 circuit configs. - @Config.RequiresMcRestart - public float pollutionReleasedByThrottle; - @Config.Comment("Controls the pollution released per second by the large gas turbine.") - @Config.DefaultInt(300) - @Config.RequiresMcRestart - public int pollutionLargeGasTurbinePerSecond; - @Config.Comment("Controls the pollution released per second by the multi smelter.") - @Config.DefaultInt(400) - @Config.RequiresMcRestart - public int pollutionMultiSmelterPerSecond; - @Config.Comment("Controls the pollution released per second by the pyrolyse oven.") - @Config.DefaultInt(300) - @Config.RequiresMcRestart - public int pollutionPyrolyseOvenPerSecond; - @Config.Comment("Controls the pollution released per second by the small coil boiler.") - @Config.DefaultInt(20) - @Config.RequiresMcRestart - public int pollutionSmallCoalBoilerPerSecond; - @Config.Comment("Controls the pollution released per second by the high pressure lava boiler.") - @Config.DefaultInt(20) - @Config.RequiresMcRestart - public int pollutionHighPressureLavaBoilerPerSecond; - @Config.Comment("Controls the pollution released per second by the high pressure coil boiler.") - @Config.DefaultInt(30) - @Config.RequiresMcRestart - public int pollutionHighPressureCoalBoilerPerSecond; - - @Config.Comment("Controls the pollution released per second by the base diesel generator.") - @Config.DefaultInt(40) - @Config.RequiresMcRestart - public int pollutionBaseDieselGeneratorPerSecond; - - // reading double as strings, not perfect, but better than nothing - @Config.Comment({ - "Pollution released by tier, with the following formula: PollutionBaseDieselGeneratorPerSecond * PollutionDieselGeneratorReleasedByTier[Tier]", - "The first entry has meaning as it is here to since machine tier with array index: LV is 1, etc." }) - @Config.DefaultDoubleList({ 0.1, 1.0, 0.9, 0.8 }) - @Config.RequiresMcRestart - public double[] pollutionDieselGeneratorReleasedByTier; - - @Config.Comment("Controls the pollution released per second by the base gas turbine.") - @Config.DefaultInt(40) - @Config.RequiresMcRestart - public int pollutionBaseGasTurbinePerSecond; - - // reading double as strings, not perfect, but better than nothing - @Config.Comment({ - "Pollution released by tier, with the following formula: PollutionBaseGasTurbinePerSecond * PollutionGasTurbineReleasedByTier[Tier]", - "The first entry has meaning as it is here to since machine tier with array index: LV is 1, etc." }) - @Config.DefaultDoubleList({ 0.1, 1.0, 0.9, 0.8, 0.7, 0.6 }) - @Config.RequiresMcRestart - public double[] pollutionGasTurbineReleasedByTier; - } } diff --git a/src/main/java/gregtech/common/misc/GTCommand.java b/src/main/java/gregtech/common/misc/GTCommand.java index f1590ec792..e6fbe12144 100644 --- a/src/main/java/gregtech/common/misc/GTCommand.java +++ b/src/main/java/gregtech/common/misc/GTCommand.java @@ -25,8 +25,8 @@ import gregtech.api.enums.GTValues; import gregtech.api.objects.GTChunkManager; import gregtech.api.util.GTMusicSystem; import gregtech.api.util.GTUtility; -import gregtech.common.Pollution; import gregtech.common.misc.spaceprojects.SpaceProjectManager; +import gregtech.common.pollution.Pollution; public final class GTCommand extends CommandBase { diff --git a/src/main/java/gregtech/common/pollution/BlockMatcher.java b/src/main/java/gregtech/common/pollution/BlockMatcher.java new file mode 100644 index 0000000000..a701d323bd --- /dev/null +++ b/src/main/java/gregtech/common/pollution/BlockMatcher.java @@ -0,0 +1,96 @@ +package gregtech.common.pollution; + +import java.util.Map; +import java.util.Set; + +import net.minecraft.block.Block; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraftforge.event.world.WorldEvent; + +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; +import cpw.mods.fml.common.registry.GameData; +import gregtech.GTMod; + +// Shamelessly Taken from BetterFoliage by octarine-noise +public class BlockMatcher { + + public Map<Class<?>, ColorOverrideType> whiteList = Maps.newHashMap(); + public Set<Class<?>> blackList = Sets.newHashSet(); + public Map<Integer, ColorOverrideType> blockIDs = Maps.newHashMap(); + + public ColorOverrideType matchesID(int blockId) { + return blockIDs.get(blockId); + } + + public ColorOverrideType matchesID(Block block) { + return blockIDs.get(Block.blockRegistry.getIDForObject(block)); + } + + public void updateClassList(String[] cfg) { + whiteList.clear(); + blackList.clear(); + for (String line : cfg) { + GTMod.GT_FML_LOGGER.info("Checking for block:" + line); + String[] lines = line.split(":"); + ColorOverrideType type = null; + if (lines.length > 1) { + try { + type = ColorOverrideType.fromName(lines[1].trim()); + } catch (NumberFormatException e) { + GTMod.GT_FML_LOGGER.error(String.format("Invalid type [%s]", line)); + continue; + } + } + + if (lines[0].startsWith("-")) { + try { + blackList.add(Class.forName(lines[0].substring(1))); + GTMod.GT_FML_LOGGER.info("\t added blacklist:" + lines[0].substring(1)); + } catch (ClassNotFoundException ignored) {} + } else { + if (type == null) { + GTMod.GT_FML_LOGGER.error(String.format("Invalid type [%s]", line)); + continue; + } + + try { + whiteList.put(Class.forName(lines[0]), type); + GTMod.GT_FML_LOGGER.info("\t added whitelist:" + lines[0]); + } catch (ClassNotFoundException ignored) {} + } + } + // updateBlockIDs(); + } + + private void updateBlockIDs() { + blockIDs.clear(); + FMLControlledNamespacedRegistry<Block> blockRegistry = GameData.getBlockRegistry(); + for (Block block : blockRegistry.typeSafeIterable()) { + ColorOverrideType t = matchesClass(block); + if (t != null) blockIDs.put(Block.blockRegistry.getIDForObject(block), t); + } + } + + private ColorOverrideType matchesClass(Block block) { + for (Class<?> clazz : blackList) if (clazz.isAssignableFrom(block.getClass())) return null; + for (Class<?> clazz : whiteList.keySet()) + if (clazz.isAssignableFrom(block.getClass())) return whiteList.get(clazz); + return null; + } + + /** + * Caches block IDs on world load for fast lookup + * + * @param event + */ + @SubscribeEvent + public void handleWorldLoad(WorldEvent.Load event) { + if (event.world instanceof WorldClient) { + updateBlockIDs(); + } + } +} diff --git a/src/main/java/gregtech/common/pollution/ColorOverrideType.java b/src/main/java/gregtech/common/pollution/ColorOverrideType.java new file mode 100644 index 0000000000..de0a44a835 --- /dev/null +++ b/src/main/java/gregtech/common/pollution/ColorOverrideType.java @@ -0,0 +1,28 @@ +package gregtech.common.pollution; + +public enum ColorOverrideType { + + FLOWER, + GRASS, + LEAVES, + LIQUID; + + public static ColorOverrideType fromName(String name) { + return switch (name) { + case "FLOWER" -> FLOWER; + case "GRASS" -> GRASS; + case "LEAVES" -> LEAVES; + case "LIQUID" -> LIQUID; + default -> throw new RuntimeException(); + }; + } + + public int getColor(int oColor, int x, int z) { + return switch (this) { + case FLOWER -> PollutionRenderer.colorFoliage(oColor, x, z); + case GRASS -> PollutionRenderer.colorGrass(oColor, x, z); + case LEAVES -> PollutionRenderer.colorLeaves(oColor, x, z); + case LIQUID -> PollutionRenderer.colorLiquid(oColor, x, z); + }; + } +} diff --git a/src/main/java/gregtech/common/entities/EntityFXPollution.java b/src/main/java/gregtech/common/pollution/EntityFXPollution.java index facd3d3364..f1a1f18447 100644 --- a/src/main/java/gregtech/common/entities/EntityFXPollution.java +++ b/src/main/java/gregtech/common/pollution/EntityFXPollution.java @@ -1,4 +1,4 @@ -package gregtech.common.entities; +package gregtech.common.pollution; import java.util.Random; diff --git a/src/main/java/gregtech/common/misc/GTClientPollutionMap.java b/src/main/java/gregtech/common/pollution/GTClientPollutionMap.java index 546f8e8d12..0fd1da309b 100644 --- a/src/main/java/gregtech/common/misc/GTClientPollutionMap.java +++ b/src/main/java/gregtech/common/pollution/GTClientPollutionMap.java @@ -1,4 +1,4 @@ -package gregtech.common.misc; +package gregtech.common.pollution; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; diff --git a/src/main/java/gregtech/common/Pollution.java b/src/main/java/gregtech/common/pollution/Pollution.java index 4245a0ef12..10b8ffcfa7 100644 --- a/src/main/java/gregtech/common/Pollution.java +++ b/src/main/java/gregtech/common/pollution/Pollution.java @@ -1,4 +1,4 @@ -package gregtech.common; +package gregtech.common.pollution; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; import static gregtech.common.GTProxy.dimensionWisePollution; @@ -45,7 +45,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.net.GTPacketPollution; import gregtech.api.util.GTChunkAssociatedData; import gregtech.api.util.GTUtility; -import gregtech.common.render.PollutionRenderer; public class Pollution { @@ -101,6 +100,33 @@ public class Pollution { pollutionInstance.tickPollutionInWorld((int) (aEvent.world.getTotalWorldTime() % cycleLen)); } + public static BlockMatcher standardBlocks; + public static BlockMatcher liquidBlocks; + public static BlockMatcher doublePlants; + public static BlockMatcher crossedSquares; + public static BlockMatcher blockVine; + + public static void onPostInitClient() { + if (PollutionConfig.pollution) { + standardBlocks = new BlockMatcher(); + liquidBlocks = new BlockMatcher(); + doublePlants = new BlockMatcher(); + crossedSquares = new BlockMatcher(); + blockVine = new BlockMatcher(); + standardBlocks.updateClassList(PollutionConfig.renderStandardBlock); + liquidBlocks.updateClassList(PollutionConfig.renderBlockLiquid); + doublePlants.updateClassList(PollutionConfig.renderBlockDoublePlant); + crossedSquares.updateClassList(PollutionConfig.renderCrossedSquares); + blockVine.updateClassList(PollutionConfig.renderblockVine); + MinecraftForge.EVENT_BUS.register(standardBlocks); + MinecraftForge.EVENT_BUS.register(liquidBlocks); + MinecraftForge.EVENT_BUS.register(doublePlants); + MinecraftForge.EVENT_BUS.register(crossedSquares); + MinecraftForge.EVENT_BUS.register(blockVine); + MinecraftForge.EVENT_BUS.register(new PollutionTooltip()); + } + } + private void tickPollutionInWorld(int aTickID) { // called from method above // gen data set if (aTickID == 0 || blank) { @@ -406,7 +432,7 @@ public class Pollution { addPollution(aWorld.getChunkFromBlockCoords(aPos.chunkPosX, aPos.chunkPosZ), aPollution); } - static void migrate(ChunkDataEvent.Load e) { + public static void migrate(ChunkDataEvent.Load e) { addPollution( e.getChunk(), e.getData() diff --git a/src/main/java/gregtech/common/pollution/PollutionConfig.java b/src/main/java/gregtech/common/pollution/PollutionConfig.java new file mode 100644 index 0000000000..90098791c4 --- /dev/null +++ b/src/main/java/gregtech/common/pol |
