From f3a05750c6a2aa26e8cc137f702a3696da1549ee Mon Sep 17 00:00:00 2001 From: Falkreon Date: Sun, 31 Dec 2017 13:14:47 -0500 Subject: [PATCH] Remove unintentional hard dependency on ProbeData. Closes #6 and #7 --- build.gradle | 2 +- .../com/elytradev/thermionics/data/ProbeDataSupport.java | 1 + .../elytradev/thermionics/tileentity/TileEntityBattery.java | 5 ++++- .../elytradev/thermionics/tileentity/TileEntityMachine.java | 5 ++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 4f483bf..591e6f4 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ repositories { def mc_version='1.12.1'; def jei_version="4.7.8.92"; -def concrete_version="0.3.5-SNAPSHOT"; +def concrete_version="0.3.6-SNAPSHOT"; //def concrete_modules=[]; //For eclipse import def concrete_modules=["common","inventory","recipe","network","reflect"]; def project_package='com.elytradev.thermionics'; diff --git a/src/main/java/com/elytradev/thermionics/data/ProbeDataSupport.java b/src/main/java/com/elytradev/thermionics/data/ProbeDataSupport.java index 5791d1e..f692036 100644 --- a/src/main/java/com/elytradev/thermionics/data/ProbeDataSupport.java +++ b/src/main/java/com/elytradev/thermionics/data/ProbeDataSupport.java @@ -187,6 +187,7 @@ public void provideProbeData(List data) { } public static void addRFData(IEnergyStorage storage, List list) { + if (storage==null) return; //Odd! list.add(new ProbeData(new TextComponentTranslation("thermionics.data.energystorage")) .withBar(0, storage.getEnergyStored(), storage.getMaxEnergyStored(), UnitDictionary.FORGE_ENERGY)); if (storage instanceof ITransferRate) { diff --git a/src/main/java/com/elytradev/thermionics/tileentity/TileEntityBattery.java b/src/main/java/com/elytradev/thermionics/tileentity/TileEntityBattery.java index 2f9943e..67786f6 100644 --- a/src/main/java/com/elytradev/thermionics/tileentity/TileEntityBattery.java +++ b/src/main/java/com/elytradev/thermionics/tileentity/TileEntityBattery.java @@ -44,6 +44,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.IEnergyStorage; +import net.minecraftforge.fml.common.Loader; public class TileEntityBattery extends TileEntity implements ITickable { protected CapabilityProvider capabilities = new CapabilityProvider(); @@ -60,7 +61,9 @@ public TileEntityBattery() { energyStorage.listen(this::markDirty); - ProbeDataSupport.registerRFInspector(this, capabilities); + if (Loader.isModLoaded("probedataprovider")) { + ProbeDataSupport.registerRFInspector(this, capabilities); + } } @Override diff --git a/src/main/java/com/elytradev/thermionics/tileentity/TileEntityMachine.java b/src/main/java/com/elytradev/thermionics/tileentity/TileEntityMachine.java index c3c0df1..4ae9f45 100644 --- a/src/main/java/com/elytradev/thermionics/tileentity/TileEntityMachine.java +++ b/src/main/java/com/elytradev/thermionics/tileentity/TileEntityMachine.java @@ -36,12 +36,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.fml.common.Loader; public class TileEntityMachine extends TileEntity { protected CapabilityProvider capabilities = new CapabilityProvider(); public TileEntityMachine() { - ProbeDataSupport.registerMachineInspector(this, capabilities); + if (Loader.isModLoaded("probedataprovider")) { + ProbeDataSupport.registerMachineInspector(this, capabilities); + } } public EnumFacing getFacing() {