feat: add HBM fluid blacklist

This commit is contained in:
LordMZTE 2024-08-08 13:34:26 +02:00
parent 897c07a181
commit e5e66fa8d1
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
4 changed files with 50 additions and 21 deletions

View file

@ -1,6 +1,7 @@
package mekanism.api;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import mekanism.api.util.UnitDisplayUtils.EnergyType;
@ -73,6 +74,7 @@ public class MekanismConfig {
public static boolean OreDictOsmium;
public static boolean OreDictPlatinum;
public static int elementizerFailChanceMultiplier;
public static HashSet<String> hbmFluidBlacklist = new HashSet<>();
}
public static class client {

View file

@ -586,15 +586,14 @@ public class CommonProxy implements IGuiProvider {
if (s != null) {
if (s.trim().equalsIgnoreCase("j") || s.trim().equalsIgnoreCase("joules")) {
general.energyUnit = EnergyType.J;
}
else if(s.trim().equalsIgnoreCase("rf") || s.trim().equalsIgnoreCase("te") || s.trim().equalsIgnoreCase("thermal expansion"))
{
} else if (s.trim().equalsIgnoreCase("rf") || s.trim().equalsIgnoreCase("te")
|| s.trim().equalsIgnoreCase("thermal expansion")) {
general.energyUnit = EnergyType.RF;
} else if (s.trim().equalsIgnoreCase("eu") || s.trim().equalsIgnoreCase("ic2")) {
} else if (s.trim().equalsIgnoreCase("eu")
|| s.trim().equalsIgnoreCase("ic2")) {
general.energyUnit = EnergyType.EU;
}
else if(s.trim().equalsIgnoreCase("mj") || s.trim().equalsIgnoreCase("bc") || s.trim().equalsIgnoreCase("buildcraft"))
{
} else if (s.trim().equalsIgnoreCase("mj") || s.trim().equalsIgnoreCase("bc")
|| s.trim().equalsIgnoreCase("buildcraft")) {
general.energyUnit = EnergyType.MJ;
}
}
@ -612,17 +611,19 @@ public class CommonProxy implements IGuiProvider {
if (s != null) {
if (s.trim().equalsIgnoreCase("k") || s.trim().equalsIgnoreCase("kelvin")) {
general.tempUnit = TempType.K;
}
else if(s.trim().equalsIgnoreCase("c") || s.trim().equalsIgnoreCase("celsius") || s.trim().equalsIgnoreCase("centigrade"))
{
} else if (s.trim().equalsIgnoreCase("c")
|| s.trim().equalsIgnoreCase("celsius")
|| s.trim().equalsIgnoreCase("centigrade")) {
general.tempUnit = TempType.C;
} else if (s.trim().equalsIgnoreCase("r") || s.trim().equalsIgnoreCase("rankine")) {
} else if (s.trim().equalsIgnoreCase("r")
|| s.trim().equalsIgnoreCase("rankine")) {
general.tempUnit = TempType.R;
} else if (s.trim().equalsIgnoreCase("f") || s.trim().equalsIgnoreCase("fahrenheit")) {
} else if (s.trim().equalsIgnoreCase("f")
|| s.trim().equalsIgnoreCase("fahrenheit")) {
general.tempUnit = TempType.F;
}
else if(s.trim().equalsIgnoreCase("a") || s.trim().equalsIgnoreCase("ambient") || s.trim().equalsIgnoreCase("stp"))
{
} else if (s.trim().equalsIgnoreCase("a")
|| s.trim().equalsIgnoreCase("ambient")
|| s.trim().equalsIgnoreCase("stp")) {
general.tempUnit = TempType.STP;
}
}
@ -639,6 +640,13 @@ public class CommonProxy implements IGuiProvider {
= Mekanism.configuration.get("general", "ElementizerFailChanceMultiplier", 1)
.getInt();
for (String entry :
Mekanism.configuration
.get("general", "HBMFluidBlacklist", new String[] { "AMAT", "ASCHRAB" })
.getStringList()) {
general.hbmFluidBlacklist.add(entry);
};
for (MachineType type : MachineType.getValidMachines()) {
machines.setEntry(
type.name,

View file

@ -1,18 +1,19 @@
package mekanism.common.integration;
import org.apache.commons.lang3.StringUtils;
import java.util.HashSet;
import com.google.common.collect.HashBiMap;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mekanism.api.MekanismConfig;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.apache.commons.lang3.StringUtils;
public class HBMIntegration {
public static final HBMIntegration INSTANCE = new HBMIntegration();
@ -24,7 +25,8 @@ public class HBMIntegration {
public void registerHBMFluids() {
for (FluidType fluid : Fluids.getAll()) {
if (fluid == Fluids.NONE)
if (fluid == Fluids.NONE
|| MekanismConfig.general.hbmFluidBlacklist.contains(fluid.getName()))
continue;
Fluid forgeFluid = FluidRegistry.getFluid(fluid.getName().toLowerCase());
@ -39,10 +41,12 @@ public class HBMIntegration {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onStitch(TextureStitchEvent.Pre ev) {
if (ev.map.getTextureType() != 0) return;
if (ev.map.getTextureType() != 0)
return;
for (Fluid fl : this.fluidMap.keySet()) {
if (!(fl instanceof HBMFluid)) continue;
if (!(fl instanceof HBMFluid))
continue;
HBMFluid hbmfl = (HBMFluid) fl;
long nslash = ev.map.basePath.chars().filter(c -> c == '/').count() + 1;
@ -52,7 +56,9 @@ public class HBMIntegration {
for (int i = 0; i < nslash; i++) {
sb.append("../");
}
sb.append(StringUtils.removeEnd(hbmfl.hbm.getTexture().getResourcePath(), ".png"));
sb.append(
StringUtils.removeEnd(hbmfl.hbm.getTexture().getResourcePath(), ".png")
);
hbmfl.setIcons(ev.map.registerIcon(sb.toString()));
}

View file

@ -9,6 +9,7 @@ import mekanism.common.tile.heatconductor.IHeatConductorModAdapter;
import mekanism.common.tile.heatconductor.ModAdapterHBM;
import mekanism.common.tile.heatconductor.ModAdapterIC2;
import mekanism.common.util.HeatUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -101,6 +102,18 @@ public class TileEntityHeatConductor extends TileEntity
return null;
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
nbt.setDouble("temperature", this.temperature);
nbt.setDouble("heatToAbsorb", this.heatToAbsorb);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
this.temperature = nbt.getDouble("temperature");
this.heatToAbsorb = nbt.getDouble("heatToAbsorb");
}
@Override
@Optional.Method(modid = "IC2")
public int maxrequestHeatTick(ForgeDirection directionFrom) {