diff options
| author | MuXiu1997 <MuXiu1997@Gmail.com> | 2022-04-24 16:57:15 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-24 10:57:15 +0200 |
| commit | 35d6cdfa50e85e2cd37301732879c32e577b9186 (patch) | |
| tree | 2c8ee34ea76739aa7e863f508e62b9603ffd72fd /src/main/java/com | |
| parent | 83a5a29cc744e45d35cb46451d0395759f3f37b2 (diff) | |
| download | GT5-Unofficial-35d6cdfa50e85e2cd37301732879c32e577b9186.tar.gz GT5-Unofficial-35d6cdfa50e85e2cd37301732879c32e577b9186.tar.bz2 GT5-Unofficial-35d6cdfa50e85e2cd37301732879c32e577b9186.zip | |
Void miners Blacklist config (#117)
* Void miners Blacklist config
* Fix things
Former-commit-id: ecb7ed00a5b287ef0e87f7ec32623717341008be
Diffstat (limited to 'src/main/java/com')
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java index 11c97e6b8e..5a810c82cb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java @@ -23,11 +23,14 @@ package com.github.bartimaeusnek.bartworks.common.configs; -import com.github.bartimaeusnek.bartworks.ASM.BWCoreTransformer; import com.github.bartimaeusnek.bartworks.API.API_ConfigValues; +import com.github.bartimaeusnek.bartworks.ASM.BWCoreTransformer; import net.minecraftforge.common.config.Configuration; import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; public class ConfigHandler { @@ -75,6 +78,8 @@ public class ConfigHandler { public static int pollutionHeatedWaterPumpSecond = 5; public static int basePollutionMBFSecond = 400; + public static Set<String> voidMinerBlacklist = Collections.unmodifiableSet(new HashSet<>()); + private static final int[][] METAFORTIERS_ENERGY = { {100, 101, 102, 105}, {1110, 1115, 1120, 1127}, @@ -136,6 +141,7 @@ public class ConfigHandler { ConfigHandler.DEHPDirectSteam = ConfigHandler.c.get("Multiblocks", "DEHP Direct Steam Mode", false, "This switch enables the Direct Steam Mode of the DEHP. If enabled it will take in Waterand output steam. If disabled it will Input IC2Coolant and output hot coolant").getBoolean(false); ConfigHandler.megaMachinesMax = ConfigHandler.c.get("Multiblocks", "Mega Machines Maximum Recipes per Operation", 256, "This changes the Maximum Recipes per Operation to the specified Valure").getInt(256); ConfigHandler.bioVatMaxParallelBonus = ConfigHandler.c.get("Multiblocks","BioVat Maximum Bonus on Recipes", 1000,"This are the maximum parallel Operations the BioVat can do, when the output is half full.").getInt(1000); + ConfigHandler.voidMinerBlacklist = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(ConfigHandler.c.get("Multiblocks", "Void Miner Blacklist", new String[0], "This is a blacklist for the Void Miner, blacklisted ores will not enter the drop prize pool. Please fill in the Unique Identifier of Ore and connect Damage with a colon, For example: gregtech:gt.blockores:32").getStringList()))); ConfigHandler.pollutionHeatedWaterPumpSecond = ConfigHandler.c.get("Pollution", "Pollution produced per second by the water pump", ConfigHandler.pollutionHeatedWaterPumpSecond, "How much should the Simple Stirling Water Pump produce pollution per second").getInt(ConfigHandler.pollutionHeatedWaterPumpSecond); ConfigHandler.basePollutionMBFSecond = ConfigHandler.c.get("Pollution", "Pollution produced per tick by the MBF per ingot", ConfigHandler.basePollutionMBFSecond,"How much should the MBF produce pollution per tick per ingot. Then it'll be multiplied by the amount of ingots done in parallel").getInt(ConfigHandler.basePollutionMBFSecond); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/GT_TileEntity_VoidMiner_Base.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/GT_TileEntity_VoidMiner_Base.java index 2f5dd0c7b9..fbade9d8dc 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/GT_TileEntity_VoidMiner_Base.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticgreg/GT_TileEntity_VoidMiner_Base.java @@ -34,6 +34,7 @@ import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import com.github.bartimaeusnek.bartworks.system.oregen.BW_OreLayer; import com.github.bartimaeusnek.bartworks.util.Pair; import com.google.common.collect.ArrayListMultimap; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -231,7 +232,10 @@ public abstract class GT_TileEntity_VoidMiner_Base extends GT_MetaTileEntity_Dri } private void addDrop(Pair<Integer,Boolean> key, float value){ - if(!dropmap.containsKey(key)) + final ItemStack ore = getOreItemStack(key); + if (ConfigHandler.voidMinerBlacklist.contains(String.format("%s:%d", GameRegistry.findUniqueIdentifierFor(ore.getItem()).toString(), ore.getItemDamage()))) + return; + if (!dropmap.containsKey(key)) dropmap.put(key, value); else dropmap.put(key, dropmap.get(key) + value); @@ -426,7 +430,7 @@ public abstract class GT_TileEntity_VoidMiner_Base extends GT_MetaTileEntity_Dri private void handleOutputs() { Pair<Integer, Boolean> stats = getOreDamage(); final List<ItemStack> inputOres = this.getStoredInputs().stream().filter(GT_Utility::isOre).collect(Collectors.toList()); - final ItemStack output = new ItemStack(stats.getValue() ? WerkstoffLoader.BWOres : GregTech_API.sBlockOres1, multiplier, stats.getKey()); + final ItemStack output = getOreItemStack(stats); if (inputOres.size() == 0 || (mBlacklist && inputOres.stream().allMatch(is -> !GT_Utility.areStacksEqual(is, output))) || (!mBlacklist && inputOres.stream().anyMatch(is -> GT_Utility.areStacksEqual(is, output))) @@ -434,6 +438,10 @@ public abstract class GT_TileEntity_VoidMiner_Base extends GT_MetaTileEntity_Dri this.updateSlots(); } + private ItemStack getOreItemStack(Pair<Integer, Boolean> stats) { + return new ItemStack(stats.getValue() ? WerkstoffLoader.BWOres : GregTech_API.sBlockOres1, multiplier, stats.getKey()); + } + @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { mBlacklist = !mBlacklist; |
