It's openContainer, not inventoryContainer. Also fix network update stuff

This commit is contained in:
Christian 2012-11-16 20:24:08 -05:00
parent 42f90b109a
commit dc82c9ace6
7 changed files with 28 additions and 23 deletions

View file

@ -170,7 +170,6 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
return;
} else if (CoreProxy.proxy.isSimulating(worldObj) && updateNetworkTime.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
System.out.printf("Server Anim state: %d %f\n", animationStage, animationSpeed);
sendNetworkUpdate();
}

View file

@ -62,7 +62,7 @@ public class PacketHandlerSilicon implements IPacketHandler {
private void onSelectionUpdate(EntityPlayer player, PacketUpdate packet) {
Container container = player.inventoryContainer;
Container container = player.openContainer;
if (container instanceof ContainerAssemblyTable) {
SelectionMessage message = new SelectionMessage();

View file

@ -252,7 +252,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
if (renderState.isDirty()){
worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord);
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
renderState.clean();
}
@ -621,7 +621,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
}
break;
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
@Override

View file

@ -61,6 +61,8 @@ public class ContainerGateInterface extends BuildCraftContainer {
// Do not attempt to create a list of potential actions and triggers on
// the client.
System.out.printf("Gate gui %s\n", this);
if (!CoreProxy.proxy.isRenderWorld(pipe.worldObj)) {
_potentialActions.addAll(pipe.getActions());
_potentialTriggers.addAll(ActionManager.getPipeTriggers(pipe));
@ -88,6 +90,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
if (!_potentialActions.contains(a))
_potentialActions.add(a);
}
System.out.printf("Action list %s %s\n", _potentialActions, _potentialTriggers);
}
}
@ -275,6 +278,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
PacketUpdate packet = new PacketUpdate(PacketIds.GATE_ACTIONS, pipe.xCoord, pipe.yCoord, pipe.zCoord, payload);
System.out.printf("Packet to player %s\n", packet);
// Send to player
CoreProxy.proxy.sendToPlayer(player, packet);
}

View file

@ -296,6 +296,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
@Override
protected void mouseClicked(int i, int j, int k) {
System.out.printf("Mouse click %d %d %d\n", i,j,k);
super.mouseClicked(i, j, k);
int cornerX = (width - xSize) / 2;

View file

@ -107,7 +107,7 @@ public class PacketHandlerTransport implements IPacketHandler {
* @param packet
*/
private void onGateActions(EntityPlayer player, PacketUpdate packet) {
Container container = player.inventoryContainer;
Container container = player.openContainer;
if (!(container instanceof ContainerGateInterface))
return;
@ -121,7 +121,7 @@ public class PacketHandlerTransport implements IPacketHandler {
* @param packet
*/
private void onGateTriggers(EntityPlayer player, PacketUpdate packet) {
Container container = player.inventoryContainer;
Container container = player.openContainer;
if (!(container instanceof ContainerGateInterface))
return;
@ -135,7 +135,7 @@ public class PacketHandlerTransport implements IPacketHandler {
* @param packet
*/
private void onGateSelection(EntityPlayer player, PacketUpdate packet) {
Container container = player.inventoryContainer;
Container container = player.openContainer;
if (!(container instanceof ContainerGateInterface))
return;
@ -248,10 +248,10 @@ public class PacketHandlerTransport implements IPacketHandler {
* @param packet
*/
private void onGateSelectionChange(EntityPlayer playerEntity, PacketUpdate packet) {
if (!(playerEntity.inventoryContainer instanceof ContainerGateInterface))
if (!(playerEntity.openContainer instanceof ContainerGateInterface))
return;
((ContainerGateInterface) playerEntity.inventoryContainer).handleSelectionChange(packet);
((ContainerGateInterface) playerEntity.openContainer).handleSelectionChange(packet);
}
/**
@ -261,10 +261,10 @@ public class PacketHandlerTransport implements IPacketHandler {
* @param packet
*/
private void onGateSelectionRequest(EntityPlayer playerEntity, PacketCoordinates packet) {
if (!(playerEntity.inventoryContainer instanceof ContainerGateInterface))
if (!(playerEntity.openContainer instanceof ContainerGateInterface))
return;
((ContainerGateInterface) playerEntity.inventoryContainer).sendSelection(playerEntity);
((ContainerGateInterface) playerEntity.openContainer).sendSelection(playerEntity);
}
/**
@ -274,10 +274,11 @@ public class PacketHandlerTransport implements IPacketHandler {
* @param packet
*/
private void onGateInitRequest(EntityPlayer playerEntity, PacketCoordinates packet) {
if (!(playerEntity.inventoryContainer instanceof ContainerGateInterface))
System.out.printf("gate init %s\n",playerEntity.openContainer);
if (!(playerEntity.openContainer instanceof ContainerGateInterface))
return;
((ContainerGateInterface) playerEntity.inventoryContainer).handleInitRequest(playerEntity);
((ContainerGateInterface) playerEntity.openContainer).handleInitRequest(playerEntity);
}
/**