Fixed with with Condenser, LevelEmiter, and Network Status Guis.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -9,6 +11,9 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -51,13 +56,27 @@ public class ContainerCondenser extends AEBaseContainer
|
||||
|
||||
if ( this.requiredEnergy != maxDisplay )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 0, (int) maxDisplay );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 0, (int) maxDisplay ), (EntityPlayerMP) icrafting );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ( this.storedPower != this.myte.storedPower )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 1, (int) this.myte.storedPower );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 1, (int) this.myte.storedPower ), (EntityPlayerMP) icrafting );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -12,6 +15,9 @@ import appeng.api.config.Settings;
|
||||
import appeng.container.slot.SlotFakeTypeOnly;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -101,7 +107,15 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
|
||||
if ( this.EmitterValue != lvlEmitter.getReportingValue() )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 2, (int) lvlEmitter.getReportingValue() );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 2, (int) lvlEmitter.getReportingValue() ), (EntityPlayerMP) icrafting );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
// icrafting.sendProgressBarUpdate( this, 2, (int) lvlEmitter.getReportingValue() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,10 @@ import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -110,10 +112,17 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) c;
|
||||
icrafting.sendProgressBarUpdate( this, 0, (int) lo_avgAddition );
|
||||
icrafting.sendProgressBarUpdate( this, 1, (int) hi_avgAddition );
|
||||
icrafting.sendProgressBarUpdate( this, 2, (int) lo_powerUsage );
|
||||
icrafting.sendProgressBarUpdate( this, 3, (int) hi_powerUsage );
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 0, (int) lo_avgAddition ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 1, (int) hi_avgAddition ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 2, (int) lo_powerUsage ), (EntityPlayerMP) icrafting );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( 3, (int) hi_powerUsage ), (EntityPlayerMP) icrafting );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import appeng.core.sync.packets.PacketMatterCannon;
|
||||
import appeng.core.sync.packets.PacketMockExplosion;
|
||||
import appeng.core.sync.packets.PacketMultiPart;
|
||||
import appeng.core.sync.packets.PacketPartPlacement;
|
||||
import appeng.core.sync.packets.PacketProgressBar;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
@@ -46,6 +47,8 @@ public class AppEngPacketHandlerBase
|
||||
|
||||
PACKET_TRANSITION_EFFECT(PacketTransitionEffect.class),
|
||||
|
||||
PACKET_PROGRESS_VALUE(PacketProgressBar.class),
|
||||
|
||||
PACKET_SWITCH_GUIS(PacketSwitchGuis.class);
|
||||
|
||||
final public Class pc;
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
@@ -19,6 +20,8 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement
|
||||
ByteBuf stream = packet.payload();
|
||||
int packetType = -1;
|
||||
|
||||
player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
try
|
||||
{
|
||||
packetType = stream.readInt();
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
|
||||
public class PacketProgressBar extends AppEngPacket
|
||||
{
|
||||
|
||||
short id;
|
||||
int value;
|
||||
|
||||
// automatic.
|
||||
public PacketProgressBar(ByteBuf stream) throws IOException {
|
||||
id = stream.readShort();
|
||||
value = stream.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
|
||||
{
|
||||
Container c = player.openContainer;
|
||||
if ( c instanceof AEBaseContainer )
|
||||
c.updateProgressBar( id, value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
|
||||
{
|
||||
Container c = player.openContainer;
|
||||
if ( c instanceof AEBaseContainer )
|
||||
c.updateProgressBar( id, value );
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketProgressBar(int short_id, int value) throws IOException {
|
||||
|
||||
this.id = (short) short_id;
|
||||
this.value = value;
|
||||
|
||||
ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt( getPacketID() );
|
||||
data.writeShort( short_id );
|
||||
data.writeInt( value );
|
||||
|
||||
configureWrite( data );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user