mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-26 23:13:07 +00:00
refactor waila plugin to reduce likelihood of crashes
This commit is contained in:
1 parent
a4c2fec3df
commit
2c021e9f95
4 files changed
+7
-28
No files matched your search
@@ -27,7 +27,7 @@ public class CastingChannelDataProvider implements IWailaDataProvider {
|
||||
CastingChannelLogic te = (CastingChannelLogic)accessor.getTileEntity();
|
||||
if (te.liquid != null && te.liquid.amount > 0) {
|
||||
FluidStack fs = te.liquid;
|
||||
currenttip.add("Liquid: " + Waila.fluidNameHelper(fs));
|
||||
currenttip.add("Liquid: " + WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add("Amount: " + fs.amount + "/" + te.getCapacity());
|
||||
} else {
|
||||
currenttip.add("§oEmpty"); // "§o" == Italics
|
||||
|
||||
@@ -27,7 +27,7 @@ public class SearedTankDataProvider implements IWailaDataProvider {
|
||||
LavaTankLogic te = (LavaTankLogic)accessor.getTileEntity();
|
||||
if (te.containsFluid()) {
|
||||
FluidStack fs = te.tank.getFluid();
|
||||
currenttip.add("Liquid: " + Waila.fluidNameHelper(fs));
|
||||
currenttip.add("Liquid: " + WailaRegistrar.fluidNameHelper(fs));
|
||||
currenttip.add("Amount: " + fs.amount + "/" + te.tank.getCapacity());
|
||||
} else {
|
||||
currenttip.add("§oEmpty"); // "§o" == Italics
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SmelteryDataProvider implements IWailaDataProvider {
|
||||
} else {
|
||||
for (int i = 0; i < fls.size(); i++) {
|
||||
FluidStack st = fls.get(i);
|
||||
currenttip.add(Waila.fluidNameHelper(st) + " (" + st.amount + "mB)");
|
||||
currenttip.add(WailaRegistrar.fluidNameHelper(st) + " (" + st.amount + "mB)");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -7,13 +7,7 @@ import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import tconstruct.blocks.LavaTankBlock;
|
||||
import tconstruct.blocks.SmelteryBlock;
|
||||
import tconstruct.blocks.logic.CastingChannelLogic;
|
||||
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -33,27 +27,12 @@ public class Waila {
|
||||
return;
|
||||
} try {
|
||||
logger.info("Waila detected. Registering TConstruct tank blocks with Waila registry.");
|
||||
|
||||
FMLInterModComms.sendMessage("Waila", "register", "tconstruct.plugins.waila.Waila.wailaCallback");
|
||||
|
||||
FMLInterModComms.sendMessage("Waila", "register", "tconstruct.plugins.waila.WailaRegistrar.wailaCallback");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void wailaCallback(IWailaRegistrar registrar) {
|
||||
logger.info("Got registrar: " + registrar);
|
||||
|
||||
// Tanks
|
||||
registrar.registerBodyProvider(new SearedTankDataProvider(), LavaTankBlock.class);
|
||||
registrar.registerBodyProvider(new CastingChannelDataProvider(), CastingChannelLogic.class);
|
||||
//registrar.registerBodyProvider(new EssenceExtractorDataProvider(), EssenceExtractor.class);
|
||||
|
||||
// Smeltery
|
||||
registrar.registerBodyProvider(new SmelteryDataProvider(), SmelteryBlock.class);
|
||||
}
|
||||
|
||||
public static String fluidNameHelper(FluidStack f) {
|
||||
return StatCollector.translateToLocal(FluidRegistry.getFluidName(f));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user