Show Channel Usage for smart and dense cable in Waila.

Waila Plugin now works when parts are in FMP Tiles.
This commit is contained in:
AlgorithmX2
2014-07-22 00:47:24 -05:00
parent 92171d36d3
commit 6aab1c2e35
3 changed files with 119 additions and 23 deletions
+18
View File
@@ -9,6 +9,7 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
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.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
@@ -222,6 +223,23 @@ public class PartCable extends AEBasePart implements IPartCable
getHost().markForUpdate();
}
@Override
public void writeToNBT(NBTTagCompound data)
{
super.writeToNBT( data );
if ( Platform.isServer() )
{
int howMany = 0;
for (IGridConnection gc : getGridNode().getConnections())
howMany = Math.max( gc.getUsedChannels(), howMany );
data.setByte( "usedChannels", (byte) howMany );
}
}
@Override
public void writeToStream(ByteBuf data) throws IOException
{