mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 14:34:28 +00:00
Remove pointless packet sending from photovoltaics
This commit is contained in:
1 parent
008adf610a
commit
095d207330
3 files changed
+13
-9
No files matched your search
@@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -22,6 +23,7 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.tool.ToolUtil;
|
||||
import crazypants.enderio.waila.IWailaInfoProvider;
|
||||
import crazypants.enderio.waila.WailaCompat;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.Util;
|
||||
|
||||
@@ -139,7 +141,7 @@ public class BlockSolarPanel extends BlockEio implements IResourceTooltipProvide
|
||||
|
||||
@Override
|
||||
public void getWailaInfo(List<String> tooltip, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileEntitySolarPanel) {
|
||||
TileEntitySolarPanel solar = (TileEntitySolarPanel) te;
|
||||
float efficiency = solar.calculateLightRatio();
|
||||
|
||||
@@ -35,7 +35,6 @@ public class TileEntitySolarPanel extends TileEntity implements IInternalPowerRe
|
||||
private static final int CHECK_INTERVAL = 100;
|
||||
|
||||
private int storedEnergyRF;
|
||||
private int lastSyncedStoredPower;
|
||||
|
||||
public TileEntitySolarPanel() {
|
||||
checkOffset = (int) (Math.random() * 20);
|
||||
@@ -123,13 +122,7 @@ public class TileEntitySolarPanel extends TileEntity implements IInternalPowerRe
|
||||
lastCollectionValue = Math.round(getEnergyPerTick() * fromSun);
|
||||
}
|
||||
if(lastCollectionValue > 0) {
|
||||
|
||||
storedEnergyRF = Math.min(lastCollectionValue + storedEnergyRF, capacitor.getMaxEnergyStored());
|
||||
if(lastSyncedStoredPower != storedEnergyRF && worldObj.getTotalWorldTime() % 40 == 0) {
|
||||
//TODO: Remove as its only used for WAILA
|
||||
lastSyncedStoredPower = storedEnergyRF;
|
||||
PacketHandler.sendToAllAround(new PacketPowerStorage(this), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
|
||||
public static final WailaCompat INSTANCE = new WailaCompat();
|
||||
|
||||
private static IWailaDataAccessor _accessor = null;
|
||||
|
||||
public static void load(IWailaRegistrar registrar) {
|
||||
registrar.registerStackProvider(INSTANCE, IFacade.class);
|
||||
registrar.registerStackProvider(INSTANCE, BlockDarkSteelAnvil.class);
|
||||
@@ -81,7 +83,9 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
|
||||
_accessor = accessor;
|
||||
|
||||
Block block = accessor.getBlock();
|
||||
TileEntity te = accessor.getTileEntity();
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
@@ -185,4 +189,9 @@ public class WailaCompat implements IWailaDataProvider {
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public static NBTTagCompound getNBTData()
|
||||
{
|
||||
return _accessor.getNBTData();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user