Changed how gui packets are sent

instead of asking the machine to send the packet the prefab asks for the
data to send. This way the need to know how to send the packet is not
needed. Rather the only thing that needs to be done is to return a new
packet with the data.
This commit is contained in:
Robert 2013-12-03 09:00:03 -05:00
parent 68e121cdfc
commit a08cc322ce
2 changed files with 6 additions and 5 deletions

View file

@ -154,6 +154,10 @@ public abstract class TileEntityEnergyMachine extends TileEntityMachine implemen
/** Called to consume power from the internal storage */ /** Called to consume power from the internal storage */
public boolean consumePower(float watts, boolean doDrain) public boolean consumePower(float watts, boolean doDrain)
{ {
if (watts <= 0)
{
return true;
}
if (!this.runPowerLess() && this.getEnergyStored() >= watts) if (!this.runPowerLess() && this.getEnergyStored() >= watts)
{ {
if (doDrain) if (doDrain)

View file

@ -46,12 +46,9 @@ public abstract class TileEntityTerminal extends TileEntityEnergyMachine impleme
} }
@Override @Override
public void sendGUIPacket(EntityPlayer entity) public Packet getGUIPacket()
{ {
if (!this.worldObj.isRemote) return this.getDescriptionPacket();
{
PacketDispatcher.sendPacketToPlayer(this.getDescriptionPacket(), (Player) entity);
}
} }
/** Sends all NBT data. Server -> Client */ /** Sends all NBT data. Server -> Client */