@Override @SideOnly(Side.CLIENT) public boolean showDurabilityBar(ItemStack itemstack) { ConsomationManager manager = TeleplatesSavedData.getClient().getConsomationManager(); return (manager.isManagerActive(EnergyConsomationManager.class) && EnergyConsomationManager.rfUsageType != 0) || (manager.isManagerActive(FluidConsomationManager.class) && FluidConsomationManager.fluidConsomationType != 0); }
@Override @SideOnly(Side.CLIENT) public double getDurabilityForDisplay(ItemStack itemstack) { if (!showDurabilityBar(itemstack)) return 0; ConsomationManager manager = TeleplatesSavedData.getClient().getConsomationManager(); double[] ds = new double[] {}; if (manager.isManagerActive(EnergyConsomationManager.class) && EnergyConsomationManager.rfUsageType != 0) { EnergyConsomationManager emanager = manager.getActiveConsomationManager(EnergyConsomationManager.class); ds = ArrayUtils.add( ds, EnergyConsomationManager.rfUsageType == 1 ? (double) emanager .getEnergyStorage(Minecraft.getMinecraft().thePlayer) .getEnergyStored() / (double) emanager .getEnergyStorage(Minecraft.getMinecraft().thePlayer) .getMaxEnergyStored() : getEnergyStored_(itemstack) / (double) getMaxEnergyStored_(itemstack)); } if (manager.isManagerActive(FluidConsomationManager.class) && FluidConsomationManager.fluidConsomationType != 0) { FluidConsomationManager fmanager = manager.getActiveConsomationManager(FluidConsomationManager.class); ds = ArrayUtils.add( ds, FluidConsomationManager.fluidConsomationType == 1 ? (double) fmanager .getFluidStorage(Minecraft.getMinecraft().thePlayer) .getFluidAmount() / (double) fmanager.getFluidStorage(Minecraft.getMinecraft().thePlayer).getCapacity() : getFluid_(itemstack).amount); } return 1 - AdvancedMathUtils.average(ds); }
public <T extends IConsomationManager> T getActiveConsomationManager(Class<T> clas) { return TeleplatesSavedData.get().getConsomationManager().getActiveConsomationManager(clas); }
public boolean isConsomationManagerActive(Class<? extends IConsomationManager> clas) { return TeleplatesSavedData.get().getConsomationManager().isManagerActive(clas); }