fixed player in net handler and deprecated proxies
This commit is contained in:
parent
f227dc2afc
commit
8f7f8d31ad
60 changed files with 237 additions and 181 deletions
|
@ -30,11 +30,6 @@ public class BuildCraftMod {
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(entityplayer);
|
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(entityplayer);
|
||||||
channels.get(Side.SERVER).writeOutbound(packet);
|
channels.get(Side.SERVER).writeOutbound(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replyToPlayer(EntityPlayer entityplayer, BuildCraftPacket packet) {
|
|
||||||
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.REPLY);
|
|
||||||
channels.get(Side.SERVER).writeOutbound(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendToServer(BuildCraftPacket packet) {
|
public void sendToServer(BuildCraftPacket packet) {
|
||||||
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
|
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class BlockArchitect extends BlockContainer {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
|
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
||||||
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
|
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
|
||||||
|
|
||||||
if (!tile.locked || entityplayer.getDisplayName().equals(tile.owner))
|
if (!tile.locked || entityplayer.getDisplayName().equals(tile.owner))
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
|
||||||
if (CoreProxy.proxy.isSimulating(world) && entityliving instanceof EntityPlayer) {
|
if (!world.isRemote && entityliving instanceof EntityPlayer) {
|
||||||
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
|
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
|
||||||
tile.owner = ((EntityPlayer) entityliving).getDisplayName();
|
tile.owner = ((EntityPlayer) entityliving).getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class BlockBuilder extends BlockContainer {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
|
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class BlockFiller extends BlockContainer {
|
||||||
if (entityplayer.isSneaking())
|
if (entityplayer.isSneaking())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
|
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public abstract class ItemBptBase extends ItemBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||||
if (CoreProxy.proxy.isSimulating(world)) {
|
if (!world.isRemote) {
|
||||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(itemStack.getItemDamage());
|
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(itemStack.getItemDamage());
|
||||||
if (bpt != null)
|
if (bpt != null)
|
||||||
return BuildCraftBuilders.getBptItemStack(itemStack.getItem(), itemStack.getItemDamage(), bpt.getName());
|
return BuildCraftBuilders.getBptItemStack(itemStack.getItem(), itemStack.getItemDamage(), bpt.getName());
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj) && isComputing) {
|
if (!worldObj.isRemote && isComputing) {
|
||||||
if (computingTime < 200) {
|
if (computingTime < 200) {
|
||||||
computingTime++;
|
computingTime++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,7 +68,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj) && box.isInitialized()) {
|
if (!worldObj.isRemote && box.isInitialized()) {
|
||||||
box.createLasers(worldObj, LaserKind.Stripes);
|
box.createLasers(worldObj, LaserKind.Stripes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
setCurrentPage(getNextPage(null));
|
setCurrentPage(getNextPage(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,8 +250,10 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
|
||||||
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (progressIn > 0 && progressIn < 100) {
|
if (progressIn > 0 && progressIn < 100) {
|
||||||
progressIn++;
|
progressIn++;
|
||||||
|
|
|
@ -177,8 +177,9 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int x = xCoord - 1; x <= xCoord + 1; ++x) {
|
for (int x = xCoord - 1; x <= xCoord + 1; ++x) {
|
||||||
for (int y = yCoord - 1; y <= yCoord + 1; ++y) {
|
for (int y = yCoord - 1; y <= yCoord + 1; ++y) {
|
||||||
|
@ -264,8 +265,9 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doWork(PowerHandler workProvider) {
|
public void doWork(PowerHandler workProvider) {
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (done)
|
if (done)
|
||||||
return;
|
return;
|
||||||
|
@ -566,7 +568,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
||||||
box.deleteLasers();
|
box.deleteLasers();
|
||||||
box.reset();
|
box.reset();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
sendNetworkUpdate(BuildCraftBuilders.instance);
|
sendNetworkUpdate(BuildCraftBuilders.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class TileFiller extends TileBuildCraft implements IInventory, IPowerRece
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord, yCoord, zCoord);
|
IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord, yCoord, zCoord);
|
||||||
|
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
|
@ -84,7 +84,7 @@ public class TileFiller extends TileBuildCraft implements IInventory, IPowerRece
|
||||||
((TileMarker) a).removeFromWorld();
|
((TileMarker) a).removeFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj) && box.isInitialized()) {
|
if (!worldObj.isRemote && box.isInitialized()) {
|
||||||
box.createLasers(worldObj, LaserKind.Stripes);
|
box.createLasers(worldObj, LaserKind.Stripes);
|
||||||
}
|
}
|
||||||
sendNetworkUpdate(BuildCraftBuilders.instance);
|
sendNetworkUpdate(BuildCraftBuilders.instance);
|
||||||
|
@ -104,7 +104,7 @@ public class TileFiller extends TileBuildCraft implements IInventory, IPowerRece
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doWork(PowerHandler workProvider) {
|
public void doWork(PowerHandler workProvider) {
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote)
|
||||||
return;
|
return;
|
||||||
if (done)
|
if (done)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
||||||
boolean showSignals = false;
|
boolean showSignals = false;
|
||||||
|
|
||||||
public void updateSignals() {
|
public void updateSignals() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
showSignals = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
showSignals = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||||
sendNetworkUpdate(BuildCraftBuilders.instance);
|
sendNetworkUpdate(BuildCraftBuilders.instance);
|
||||||
}
|
}
|
||||||
|
@ -153,8 +153,9 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tryConnection() {
|
public void tryConnection() {
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
if (!origin.isSet() || !origin.vect[j].isSet()) {
|
if (!origin.isSet() || !origin.vect[j].isSet()) {
|
||||||
|
@ -390,7 +391,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
||||||
|
|
||||||
signals = null;
|
signals = null;
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj) && markerOrigin != null && markerOrigin != this) {
|
if (!worldObj.isRemote && markerOrigin != null && markerOrigin != this) {
|
||||||
markerOrigin.sendNetworkUpdate(BuildCraftBuilders.instance);
|
markerOrigin.sendNetworkUpdate(BuildCraftBuilders.instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,9 @@ public class TilePathMarker extends TileMarker {
|
||||||
|
|
||||||
public void createLaserAndConnect(TilePathMarker pathMarker) {
|
public void createLaserAndConnect(TilePathMarker pathMarker) {
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
EntityPowerLaser laser = new EntityPowerLaser(worldObj, new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new Position(pathMarker.xCoord + 0.5,
|
EntityPowerLaser laser = new EntityPowerLaser(worldObj, new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new Position(pathMarker.xCoord + 0.5,
|
||||||
pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5));
|
pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5));
|
||||||
|
@ -97,8 +98,9 @@ public class TilePathMarker extends TileMarker {
|
||||||
@Override
|
@Override
|
||||||
public void tryConnection() {
|
public void tryConnection() {
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj) || isFullyConnected())
|
if (worldObj.isRemote || isFullyConnected()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tryingToConnect = !tryingToConnect; // Allow the user to stop the path marker from searching for new path markers to connect
|
tryingToConnect = !tryingToConnect; // Allow the user to stop the path marker from searching for new path markers to connect
|
||||||
sendNetworkUpdate(BuildCraftBuilders.instance);
|
sendNetworkUpdate(BuildCraftBuilders.instance);
|
||||||
|
@ -108,8 +110,9 @@ public class TilePathMarker extends TileMarker {
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (tryingToConnect) {
|
if (tryingToConnect) {
|
||||||
TilePathMarker nearestPathMarker = findNearestAvailablePathMarker();
|
TilePathMarker nearestPathMarker = findNearestAvailablePathMarker();
|
||||||
|
@ -171,7 +174,7 @@ public class TilePathMarker extends TileMarker {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj) && !isFullyConnected()) {
|
if (!worldObj.isRemote && !isFullyConnected()) {
|
||||||
availableMarkers.add(this);
|
availableMarkers.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +210,7 @@ public class TilePathMarker extends TileMarker {
|
||||||
links[1] = null;
|
links[1] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFullyConnected() && !availableMarkers.contains(this) && CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!isFullyConnected() && !availableMarkers.contains(this) && !worldObj.isRemote) {
|
||||||
availableMarkers.add(this);
|
availableMarkers.add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import buildcraft.core.network.PacketIds;
|
||||||
import buildcraft.core.network.PacketPayloadArrays;
|
import buildcraft.core.network.PacketPayloadArrays;
|
||||||
import buildcraft.core.network.PacketUpdate;
|
import buildcraft.core.network.PacketUpdate;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.Utils;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
@ -27,10 +28,8 @@ public class PacketHandlerBuilders extends BuildCraftChannelHandler {
|
||||||
super.decodeInto(ctx, data, packet);
|
super.decodeInto(ctx, data, packet);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
|
EntityPlayer player = Utils.getPlayerFromNetHandler(netHandler);
|
||||||
EntityPlayer player =
|
|
||||||
CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
|
||||||
|
|
||||||
int packetID = packet.getID();
|
int packetID = packet.getID();
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,12 @@ public abstract class EntityLaser extends Entity {
|
||||||
if (head == null || tail == null)
|
if (head == null || tail == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj) && needsUpdate) {
|
if (!worldObj.isRemote && needsUpdate) {
|
||||||
updateDataServer();
|
updateDataServer();
|
||||||
needsUpdate = false;
|
needsUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (worldObj.isRemote) {
|
||||||
updateDataClient();
|
updateDataClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData {
|
||||||
//System.out.printf("RobotChanging %d %d %d %s\n",target.x, target.y, target.z, target.mode);
|
//System.out.printf("RobotChanging %d %d %d %s\n",target.x, target.y, target.z, target.mode);
|
||||||
if (wait <= 0 && BlockUtil.canChangeBlock(worldObj, target.x, target.y, target.z)) {
|
if (wait <= 0 && BlockUtil.canChangeBlock(worldObj, target.x, target.y, target.z)) {
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
|
|
||||||
if (target.mode == Mode.ClearIfInvalid) {
|
if (target.mode == Mode.ClearIfInvalid) {
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendNetworkUpdate(BuildCraftMod mod) {
|
public void sendNetworkUpdate(BuildCraftMod mod) {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
mod.sendToPlayers(getUpdatePacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE);
|
mod.sendToPlayers(getUpdatePacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.NETWORK_UPDATE_RANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,9 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawSprite(int cornerX, int cornerY) {
|
public void drawSprite(int cornerX, int cornerY) {
|
||||||
if (!isDefined())
|
if (!isDefined()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getItemStack() != null) {
|
if (getItemStack() != null) {
|
||||||
drawStack(getItemStack());
|
drawStack(getItemStack());
|
||||||
|
|
|
@ -8,8 +8,11 @@ import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.Utils;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.network.INetHandler;
|
import net.minecraft.network.INetHandler;
|
||||||
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
@ -39,11 +42,8 @@ public class PacketHandler extends BuildCraftChannelHandler {
|
||||||
super.decodeInto(ctx, data, packet);
|
super.decodeInto(ctx, data, packet);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
|
EntityPlayer player = Utils.getPlayerFromNetHandler(netHandler);
|
||||||
EntityPlayer player =
|
|
||||||
CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
|
||||||
|
|
||||||
int packetID = packet.getID();
|
int packetID = packet.getID();
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class PacketUpdate extends BuildCraftPacket {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeData(ByteBuf data) {
|
public void writeData(ByteBuf data) {
|
||||||
|
data.writeByte(packetId);
|
||||||
data.writeInt(posX);
|
data.writeInt(posX);
|
||||||
data.writeInt(posY);
|
data.writeInt(posY);
|
||||||
data.writeInt(posZ);
|
data.writeInt(posZ);
|
||||||
|
@ -52,6 +53,7 @@ public class PacketUpdate extends BuildCraftPacket {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readData(ByteBuf data) {
|
public void readData(ByteBuf data) {
|
||||||
|
packetId = data.readByte();
|
||||||
posX = data.readInt();
|
posX = data.readInt();
|
||||||
posY = data.readInt();
|
posY = data.readInt();
|
||||||
posZ = data.readInt();
|
posZ = data.readInt();
|
||||||
|
|
|
@ -32,8 +32,6 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.network.INetHandler;
|
|
||||||
import net.minecraft.network.NetHandlerPlayServer;
|
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
import net.minecraft.util.ChunkCoordinates;
|
||||||
|
@ -42,6 +40,12 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class comes from the old times where there were two Minecrafts
|
||||||
|
* codebases, one client and one server. We should slowly aim at removing it.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class CoreProxy {
|
public class CoreProxy {
|
||||||
|
|
||||||
@SidedProxy(clientSide = "buildcraft.core.proxy.CoreProxyClient", serverSide = "buildcraft.core.proxy.CoreProxy")
|
@SidedProxy(clientSide = "buildcraft.core.proxy.CoreProxyClient", serverSide = "buildcraft.core.proxy.CoreProxy")
|
||||||
|
@ -60,15 +64,6 @@ public class CoreProxy {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SIMULATION */
|
|
||||||
public boolean isSimulating(World world) {
|
|
||||||
return !world.isRemote;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRenderWorld(World world) {
|
|
||||||
return world.isRemote;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCurrentLanguage() {
|
public String getCurrentLanguage() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -219,15 +214,4 @@ public class CoreProxy {
|
||||||
public EntityBlock newEntityBlock(World world, double i, double j, double k, double iSize, double jSize, double kSize, LaserKind laserKind) {
|
public EntityBlock newEntityBlock(World world, double i, double j, double k, double iSize, double jSize, double kSize, LaserKind laserKind) {
|
||||||
return new EntityBlock(world, i, j, k, iSize, jSize, kSize);
|
return new EntityBlock(world, i, j, k, iSize, jSize, kSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns either the player from the handler if it's on the
|
|
||||||
* server, or directly from the minecraft instance if it's the client.
|
|
||||||
*
|
|
||||||
* TODO: This is a bit kludgy, probably better to separate the client and
|
|
||||||
* server channels instead.
|
|
||||||
*/
|
|
||||||
public EntityPlayer getPlayerFromNetHandler (INetHandler hander) {
|
|
||||||
return ((NetHandlerPlayServer) hander).playerEntity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class CoreProxyClient extends CoreProxy {
|
||||||
public void removeEntity(Entity entity) {
|
public void removeEntity(Entity entity) {
|
||||||
super.removeEntity(entity);
|
super.removeEntity(entity);
|
||||||
|
|
||||||
if (isRenderWorld(entity.worldObj)) {
|
if (entity.worldObj.isRemote) {
|
||||||
((WorldClient) entity.worldObj).removeEntityFromWorld(entity.getEntityId());
|
((WorldClient) entity.worldObj).removeEntityFromWorld(entity.getEntityId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,4 @@ public class CoreProxyClient extends CoreProxy {
|
||||||
}
|
}
|
||||||
return eb;
|
return eb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityPlayer getPlayerFromNetHandler (INetHandler hander) {
|
|
||||||
return Minecraft.getMinecraft().thePlayer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,9 @@ import java.util.Random;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.InventoryLargeChest;
|
import net.minecraft.inventory.InventoryLargeChest;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -60,6 +62,8 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.nbt.NBTTagLong;
|
import net.minecraft.nbt.NBTTagLong;
|
||||||
import net.minecraft.nbt.NBTTagShort;
|
import net.minecraft.nbt.NBTTagShort;
|
||||||
import net.minecraft.nbt.NBTTagString;
|
import net.minecraft.nbt.NBTTagString;
|
||||||
|
import net.minecraft.network.INetHandler;
|
||||||
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityChest;
|
import net.minecraft.tileentity.TileEntityChest;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
@ -334,7 +338,7 @@ public class Utils {
|
||||||
public static void preDestroyBlock(World world, int i, int j, int k) {
|
public static void preDestroyBlock(World world, int i, int j, int k) {
|
||||||
TileEntity tile = world.getTileEntity(i, j, k);
|
TileEntity tile = world.getTileEntity(i, j, k);
|
||||||
|
|
||||||
if (tile instanceof IInventory && !CoreProxy.proxy.isRenderWorld(world)) {
|
if (tile instanceof IInventory && !world.isRemote) {
|
||||||
if (!(tile instanceof IDropControlInventory) || ((IDropControlInventory) tile).doDrop()) {
|
if (!(tile instanceof IDropControlInventory) || ((IDropControlInventory) tile).doDrop()) {
|
||||||
InvUtils.dropItems(world, (IInventory) tile, i, j, k);
|
InvUtils.dropItems(world, (IInventory) tile, i, j, k);
|
||||||
InvUtils.wipeInventory((IInventory) tile);
|
InvUtils.wipeInventory((IInventory) tile);
|
||||||
|
@ -508,4 +512,16 @@ public class Utils {
|
||||||
|
|
||||||
return new FMLProxyPacket(buf, DefaultProps.NET_CHANNEL_NAME + "-CORE");
|
return new FMLProxyPacket(buf, DefaultProps.NET_CHANNEL_NAME + "-CORE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns either the player from the handler if it's on the
|
||||||
|
* server, or directly from the minecraft instance if it's the client.
|
||||||
|
*/
|
||||||
|
public static EntityPlayer getPlayerFromNetHandler (INetHandler handler) {
|
||||||
|
if (handler instanceof NetHandlerPlayServer) {
|
||||||
|
return ((NetHandlerPlayServer) handler).playerEntity;
|
||||||
|
} else {
|
||||||
|
return Minecraft.getMinecraft().thePlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
powerHandler.configure(minEnergyReceived(), maxEnergyReceived(), 1, getMaxEnergy());
|
powerHandler.configure(minEnergyReceived(), maxEnergyReceived(), 1, getMaxEnergy());
|
||||||
checkRedstonePower();
|
checkRedstonePower();
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
}
|
}
|
||||||
|
|
||||||
public final EnergyStage getEnergyStage() {
|
public final EnergyStage getEnergyStage() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
if (energyStage == EnergyStage.OVERHEAT)
|
if (energyStage == EnergyStage.OVERHEAT)
|
||||||
return energyStage;
|
return energyStage;
|
||||||
EnergyStage newStage = computeEnergyStage();
|
EnergyStage newStage = computeEnergyStage();
|
||||||
|
@ -135,7 +135,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPistonSpeed() {
|
public float getPistonSpeed() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
return Math.max(0.16f * getHeatLevel(), 0.01f);
|
return Math.max(0.16f * getHeatLevel(), 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (worldObj.isRemote) {
|
||||||
if (progressPart != 0) {
|
if (progressPart != 0) {
|
||||||
progress += getPistonSpeed();
|
progress += getPistonSpeed();
|
||||||
|
|
||||||
|
@ -381,8 +381,9 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doWork(PowerHandler workProvider) {
|
public void doWork(PowerHandler workProvider) {
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
addEnergy(powerHandler.useEnergy(1, maxEnergyReceived(), true) * 0.95F);
|
addEnergy(powerHandler.useEnergy(1, maxEnergyReceived(), true) * 0.95F);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
}
|
}
|
||||||
ItemStack current = player.getCurrentEquippedItem();
|
ItemStack current = player.getCurrentEquippedItem();
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
if (FluidUtils.handleRightClick(this, side, player, true, true)) {
|
if (FluidUtils.handleRightClick(this, side, player, true, true)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
player.openGui(BuildCraftEnergy.instance, GuiIds.ENGINE_IRON, worldObj, xCoord, yCoord, zCoord);
|
player.openGui(BuildCraftEnergy.instance, GuiIds.ENGINE_IRON, worldObj, xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -96,7 +96,7 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getPistonSpeed() {
|
public float getPistonSpeed() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
return Math.max(0.07f * getHeatLevel(), 0.01f);
|
return Math.max(0.07f * getHeatLevel(), 0.01f);
|
||||||
}
|
}
|
||||||
switch (getEnergyStage()) {
|
switch (getEnergyStage()) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TileEngineStone extends TileEngineWithInventory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
public boolean onBlockActivated(EntityPlayer player, ForgeDirection side) {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (!worldObj.isRemote) {
|
||||||
player.openGui(BuildCraftEnergy.instance, GuiIds.ENGINE_STONE, worldObj, xCoord, yCoord, zCoord);
|
player.openGui(BuildCraftEnergy.instance, GuiIds.ENGINE_STONE, worldObj, xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class TileEngineWood extends TileEngine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getPistonSpeed() {
|
public float getPistonSpeed() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj))
|
if (!worldObj.isRemote)
|
||||||
return Math.max(0.08f * getHeatLevel(), 0.01f);
|
return Math.max(0.08f * getHeatLevel(), 0.01f);
|
||||||
switch (getEnergyStage()) {
|
switch (getEnergyStage()) {
|
||||||
case GREEN:
|
case GREEN:
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.AUTO_CRAFTING_TABLE, world, i, j, k);
|
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.AUTO_CRAFTING_TABLE, world, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class BlockHopper extends BlockBuildCraft {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.HOPPER, world, x, y, z);
|
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.HOPPER, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,9 @@ public class BlockQuarry extends BlockBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
|
public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
|
||||||
|
if (world.isRemote) {
|
||||||
if (!CoreProxy.proxy.isSimulating(world))
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(i, j, k);
|
TileEntity tile = world.getTileEntity(i, j, k);
|
||||||
if (tile instanceof TileQuarry) {
|
if (tile instanceof TileQuarry) {
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class TileFloodGate extends TileBuildCraft implements IFluidHandler {
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
if (worldObj.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (powered)
|
if (powered)
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class TileHopper extends TileBuildCraft implements IInventory {
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj) || worldObj.getTotalWorldTime() % 2 != 0)
|
if (worldObj.isRemote || worldObj.getTotalWorldTime() % 2 != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TileEntity tile = this.getWorldObj().getTileEntity(xCoord, yCoord - 1, zCoord);
|
TileEntity tile = this.getWorldObj().getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||||
|
|
|
@ -139,11 +139,11 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (!isAlive && CoreProxy.proxy.isSimulating(worldObj)) {
|
if (!isAlive && !worldObj.isRemote) {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!CoreProxy.proxy.isSimulating(worldObj) && isAlive) {
|
if (!!worldObj.isRemote && isAlive) {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj) && inProcess) {
|
if (!worldObj.isRemote && inProcess) {
|
||||||
sendNetworkUpdate(BuildCraftFactory.instance);
|
sendNetworkUpdate(BuildCraftFactory.instance);
|
||||||
}
|
}
|
||||||
if (inProcess || !isDigging)
|
if (inProcess || !isDigging)
|
||||||
|
@ -530,7 +530,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
||||||
}
|
}
|
||||||
if (chunkTicket == null) {
|
if (chunkTicket == null) {
|
||||||
isAlive = false;
|
isAlive = false;
|
||||||
if (placedBy != null && CoreProxy.proxy.isSimulating(worldObj)) {
|
if (placedBy != null && !worldObj.isRemote) {
|
||||||
((EntityPlayerMP) placedBy)
|
((EntityPlayerMP) placedBy)
|
||||||
.addChatMessage(new ChatComponentText(
|
.addChatMessage(new ChatComponentText(
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -673,7 +673,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (CoreProxy.proxy.isSimulating(this.getWorldObj()) && !box.initialized) {
|
if (!this.getWorldObj().isRemote && !box.initialized) {
|
||||||
setBoundaries(false);
|
setBoundaries(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IPowe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (worldObj.isRemote) {
|
||||||
simpleAnimationIterate();
|
simpleAnimationIterate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TileTank extends TileBuildCraft implements IFluidHandler {
|
||||||
/* UPDATING */
|
/* UPDATING */
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (worldObj.isRemote) {
|
||||||
int lightValue = getFluidLightLevel();
|
int lightValue = getFluidLightLevel();
|
||||||
if (prevLightValue != lightValue) {
|
if (prevLightValue != lightValue) {
|
||||||
prevLightValue = lightValue;
|
prevLightValue = lightValue;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ContainerAutoWorkbench extends BuildCraftContainer {
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
super.setInventorySlotContents(slot, stack);
|
super.setInventorySlotContents(slot, stack);
|
||||||
if (stack != null && tile.isLast() && CoreProxy.proxy.isRenderWorld(tile.getWorldObj())) {
|
if (stack != null && tile.isLast() && tile.getWorldObj().isRemote) {
|
||||||
InvUtils.addItemToolTip(stack, EnumChatFormatting.YELLOW + StringUtils.localize("gui.clickcraft"));
|
InvUtils.addItemToolTip(stack, EnumChatFormatting.YELLOW + StringUtils.localize("gui.clickcraft"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ContainerRefinery extends BuildCraftContainer {
|
||||||
|
|
||||||
refinery.setFilter(slot, filter);
|
refinery.setFilter(slot, filter);
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(refinery.getWorldObj())) {
|
if (refinery.getWorldObj().isRemote) {
|
||||||
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
PacketPayloadStream payload = new PacketPayloadStream(new PacketPayloadStream.StreamWriter() {
|
||||||
@Override
|
@Override
|
||||||
public void writeData(ByteBuf data) {
|
public void writeData(ByteBuf data) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import buildcraft.core.network.PacketPayload;
|
||||||
import buildcraft.core.network.PacketPayloadStream;
|
import buildcraft.core.network.PacketPayloadStream;
|
||||||
import buildcraft.core.network.PacketUpdate;
|
import buildcraft.core.network.PacketUpdate;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.Utils;
|
||||||
import buildcraft.factory.TileRefinery;
|
import buildcraft.factory.TileRefinery;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
@ -30,9 +31,7 @@ public class PacketHandlerFactory extends BuildCraftChannelHandler {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
|
EntityPlayer player = Utils.getPlayerFromNetHandler(netHandler);
|
||||||
EntityPlayer player =
|
|
||||||
CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
|
||||||
|
|
||||||
int packetID = packet.getID();
|
int packetID = packet.getID();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class BlockLaserTable extends BlockContainer {
|
||||||
if (entityplayer.isSneaking())
|
if (entityplayer.isSneaking())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
int meta = world.getBlockMetadata(i, j, k);
|
int meta = world.getBlockMetadata(i, j, k);
|
||||||
entityplayer.openGui(BuildCraftSilicon.instance, meta, world, i, j, k);
|
entityplayer.openGui(BuildCraftSilicon.instance, meta, world, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
||||||
craftSlot = new SlotCrafting(internalPlayer, internalInventoryCrafting, craftResult, 0, 0, 0);
|
craftSlot = new SlotCrafting(internalPlayer, internalInventoryCrafting, craftResult, 0, 0, 0);
|
||||||
updateRecipe();
|
updateRecipe();
|
||||||
}
|
}
|
||||||
if (!CoreProxy.proxy.isSimulating(worldObj))
|
if (!!worldObj.isRemote)
|
||||||
return;
|
return;
|
||||||
if (lastMode == ActionMachineControl.Mode.Off)
|
if (lastMode == ActionMachineControl.Mode.Off)
|
||||||
return;
|
return;
|
||||||
|
@ -369,7 +369,7 @@ public class TileAdvancedCraftingTable extends TileLaserTableBase implements IIn
|
||||||
public void updateCraftingMatrix(int slot, ItemStack stack) {
|
public void updateCraftingMatrix(int slot, ItemStack stack) {
|
||||||
craftingSlots.setInventorySlotContents(slot, stack);
|
craftingSlots.setInventorySlotContents(slot, stack);
|
||||||
updateRecipe();
|
updateRecipe();
|
||||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
if (worldObj.isRemote) {
|
||||||
PacketSlotChange packet = new PacketSlotChange(PacketIds.ADVANCED_WORKBENCH_SETSLOT, xCoord, yCoord, zCoord, slot, stack);
|
PacketSlotChange packet = new PacketSlotChange(PacketIds.ADVANCED_WORKBENCH_SETSLOT, xCoord, yCoord, zCoord, slot, stack);
|
||||||
BuildCraftSilicon.instance.sendToServer(packet);
|
BuildCraftSilicon.instance.sendToServer(packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isSimulating(worldObj))
|
if (!!worldObj.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If a gate disabled us, remove laser and do nothing.
|
// If a gate disabled us, remove laser and do nothing.
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
||||||
updateRecipes();
|
updateRecipes();
|
||||||
|
|
||||||
// Request current selection from server
|
// Request current selection from server
|
||||||
if (CoreProxy.proxy.isRenderWorld(assemblyTable.getWorldObj())) {
|
if (assemblyTable.getWorldObj().isRemote) {
|
||||||
BuildCraftSilicon.instance.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, assemblyTable.xCoord, assemblyTable.yCoord,
|
BuildCraftSilicon.instance.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, assemblyTable.xCoord, assemblyTable.yCoord,
|
||||||
assemblyTable.zCoord));
|
assemblyTable.zCoord));
|
||||||
}
|
}
|
||||||
|
@ -197,14 +197,11 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
||||||
|
|
||||||
message.stack = slot.recipe.output;
|
message.stack = slot.recipe.output;
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(table.getWorldObj())) {
|
if (table.getWorldObj().isRemote) {
|
||||||
|
|
||||||
PacketNBT packet = new PacketNBT(PacketIds.SELECTION_ASSEMBLY, message.getNBT(), table.xCoord, table.yCoord, table.zCoord);
|
PacketNBT packet = new PacketNBT(PacketIds.SELECTION_ASSEMBLY, message.getNBT(), table.xCoord, table.yCoord, table.zCoord);
|
||||||
|
|
||||||
BuildCraftSilicon.instance.sendToServer(packet);
|
BuildCraftSilicon.instance.sendToServer(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import buildcraft.core.network.PacketIds;
|
||||||
import buildcraft.core.network.PacketNBT;
|
import buildcraft.core.network.PacketNBT;
|
||||||
import buildcraft.core.network.PacketSlotChange;
|
import buildcraft.core.network.PacketSlotChange;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.Utils;
|
||||||
import buildcraft.silicon.TileAdvancedCraftingTable;
|
import buildcraft.silicon.TileAdvancedCraftingTable;
|
||||||
import buildcraft.silicon.TileAssemblyTable;
|
import buildcraft.silicon.TileAssemblyTable;
|
||||||
import buildcraft.silicon.TileAssemblyTable.SelectionMessage;
|
import buildcraft.silicon.TileAssemblyTable.SelectionMessage;
|
||||||
|
@ -33,8 +34,7 @@ public class PacketHandlerSilicon extends BuildCraftChannelHandler {
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
|
|
||||||
EntityPlayer player =
|
EntityPlayer player = Utils.getPlayerFromNetHandler(netHandler);
|
||||||
CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
|
||||||
|
|
||||||
int packetID = packet.getID();
|
int packetID = packet.getID();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class BlockFilteredBuffer extends BlockBuildCraft {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
if (!world.isRemote) {
|
||||||
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.FILTERED_BUFFER, world, x, y, z);
|
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.FILTERED_BUFFER, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -514,7 +514,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(world))
|
if (world.isRemote)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||||
|
@ -545,7 +545,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
@Override
|
@Override
|
||||||
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int dmg) {
|
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int dmg) {
|
||||||
|
|
||||||
if (CoreProxy.proxy.isRenderWorld(world))
|
if (world.isRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i1 = quantityDropped(world.rand);
|
int i1 = quantityDropped(world.rand);
|
||||||
|
@ -743,7 +743,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
private boolean stripGate(Pipe pipe) {
|
private boolean stripGate(Pipe pipe) {
|
||||||
if (pipe.hasGate()) {
|
if (pipe.hasGate()) {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
if (!pipe.container.getWorldObj().isRemote) {
|
||||||
pipe.gate.dropGate();
|
pipe.gate.dropGate();
|
||||||
}
|
}
|
||||||
pipe.resetGate();
|
pipe.resetGate();
|
||||||
|
@ -774,7 +774,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
|
|
||||||
private boolean stripWire(Pipe pipe, PipeWire color) {
|
private boolean stripWire(Pipe pipe, PipeWire color) {
|
||||||
if (pipe.wireSet[color.ordinal()]) {
|
if (pipe.wireSet[color.ordinal()]) {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
if (!pipe.container.getWorldObj().isRemote) {
|
||||||
dropWire(color, pipe);
|
dropWire(color, pipe);
|
||||||
}
|
}
|
||||||
pipe.wireSet[color.ordinal()] = false;
|
pipe.wireSet[color.ordinal()] = false;
|
||||||
|
|
|
@ -147,7 +147,7 @@ public final class Gate {
|
||||||
|
|
||||||
// GUI
|
// GUI
|
||||||
public void openGui(EntityPlayer player) {
|
public void openGui(EntityPlayer player) {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(player.worldObj)) {
|
if (!player.worldObj.isRemote) {
|
||||||
player.openGui(BuildCraftTransport.instance, GuiIds.GATES, pipe.container.getWorldObj(), pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord);
|
player.openGui(BuildCraftTransport.instance, GuiIds.GATES, pipe.container.getWorldObj(), pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,8 +188,9 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (CoreProxy.proxy.isRenderWorld(container.getWorldObj()))
|
if (container.getWorldObj().isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
moveFluids();
|
moveFluids();
|
||||||
|
|
||||||
|
|
|
@ -134,8 +134,9 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (CoreProxy.proxy.isRenderWorld(container.getWorldObj()))
|
if (container.getWorldObj().isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
step();
|
step();
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
public boolean initialized = false;
|
public boolean initialized = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (deletePipe) {
|
if (deletePipe) {
|
||||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||||
|
|
|
@ -192,7 +192,7 @@ public final class TravelingItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityItem toEntityItem() {
|
public EntityItem toEntityItem() {
|
||||||
if (container != null && !CoreProxy.proxy.isRenderWorld(container.getWorldObj())) {
|
if (container != null && !container.getWorldObj().isRemote) {
|
||||||
if (getItemStack().stackSize <= 0)
|
if (getItemStack().stackSize <= 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import java.util.NavigableSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
@ -51,18 +52,21 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
|
|
||||||
IInventory playerIInventory;
|
IInventory playerIInventory;
|
||||||
Pipe pipe;
|
Pipe pipe;
|
||||||
|
|
||||||
private final NavigableSet<ITrigger> _potentialTriggers = new TreeSet<ITrigger>(new Comparator<ITrigger>() {
|
private final NavigableSet<ITrigger> _potentialTriggers = new TreeSet<ITrigger>(new Comparator<ITrigger>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(ITrigger o1, ITrigger o2) {
|
public int compare(ITrigger o1, ITrigger o2) {
|
||||||
return o1.getUniqueTag().compareTo(o2.getUniqueTag());
|
return o1.getUniqueTag().compareTo(o2.getUniqueTag());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
private final NavigableSet<IAction> _potentialActions = new TreeSet<IAction>(new Comparator<IAction>() {
|
private final NavigableSet<IAction> _potentialActions = new TreeSet<IAction>(new Comparator<IAction>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(IAction o1, IAction o2) {
|
public int compare(IAction o1, IAction o2) {
|
||||||
return o1.getUniqueTag().compareTo(o2.getUniqueTag());
|
return o1.getUniqueTag().compareTo(o2.getUniqueTag());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
private boolean isSynchronized = false;
|
private boolean isSynchronized = false;
|
||||||
private boolean isNetInitialized = false;
|
private boolean isNetInitialized = false;
|
||||||
public boolean[] triggerState = new boolean[8];
|
public boolean[] triggerState = new boolean[8];
|
||||||
|
@ -70,6 +74,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
|
|
||||||
public ContainerGateInterface(IInventory playerInventory, Pipe pipe) {
|
public ContainerGateInterface(IInventory playerInventory, Pipe pipe) {
|
||||||
super(0);
|
super(0);
|
||||||
|
|
||||||
this.playerIInventory = playerInventory;
|
this.playerIInventory = playerInventory;
|
||||||
|
|
||||||
for (int y = 0; y < 3; y++) {
|
for (int y = 0; y < 3; y++) {
|
||||||
|
@ -86,7 +91,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
|
|
||||||
// Do not attempt to create a list of potential actions and triggers on
|
// Do not attempt to create a list of potential actions and triggers on
|
||||||
// the client.
|
// the client.
|
||||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
if (!pipe.container.getWorldObj().isRemote) {
|
||||||
_potentialActions.addAll(pipe.getActions());
|
_potentialActions.addAll(pipe.getActions());
|
||||||
_potentialTriggers.addAll(ActionManager.getPipeTriggers(pipe.container));
|
_potentialTriggers.addAll(ActionManager.getPipeTriggers(pipe.container));
|
||||||
|
|
||||||
|
@ -103,10 +108,13 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
|
|
||||||
if (!pipe.gate.material.hasParameterSlot) {
|
if (!pipe.gate.material.hasParameterSlot) {
|
||||||
Iterator<ITrigger> it = _potentialTriggers.iterator();
|
Iterator<ITrigger> it = _potentialTriggers.iterator();
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
ITrigger trigger = it.next();
|
ITrigger trigger = it.next();
|
||||||
if (trigger.requiresParameter())
|
|
||||||
|
if (trigger.requiresParameter()) {
|
||||||
it.remove();
|
it.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,9 +122,11 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
if (pipe == null || pipe.gate == null)
|
if (pipe == null || pipe.gate == null) {
|
||||||
return false;
|
return false;
|
||||||
return true;
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,6 +148,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
public void updateActions(PacketUpdate packet) {
|
public void updateActions(PacketUpdate packet) {
|
||||||
_potentialActions.clear();
|
_potentialActions.clear();
|
||||||
PacketPayloadArrays payload = (PacketPayloadArrays) packet.payload;
|
PacketPayloadArrays payload = (PacketPayloadArrays) packet.payload;
|
||||||
|
|
||||||
int length = payload.intPayload[0];
|
int length = payload.intPayload[0];
|
||||||
|
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
|
@ -215,7 +226,12 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendSelectionChange(int position) {
|
public void sendSelectionChange(int position) {
|
||||||
BuildCraftTransport.instance.sendToServer(new PacketUpdate(PacketIds.GATE_SELECTION_CHANGE, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)));
|
if (pipe.container.getWorld().isRemote) {
|
||||||
|
BuildCraftTransport.instance.sendToServer(new PacketUpdate(
|
||||||
|
PacketIds.GATE_SELECTION_CHANGE, pipe.container.xCoord,
|
||||||
|
pipe.container.yCoord, pipe.container.zCoord,
|
||||||
|
getSelectionPayload(position)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,13 +239,12 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
* (re-)requests the current selection on the gate if needed.
|
* (re-)requests the current selection on the gate if needed.
|
||||||
*/
|
*/
|
||||||
public void synchronize() {
|
public void synchronize() {
|
||||||
|
if (!isNetInitialized && pipe.container.getWorldObj().isRemote) {
|
||||||
if (!isNetInitialized && CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
|
||||||
isNetInitialized = true;
|
isNetInitialized = true;
|
||||||
BuildCraftTransport.instance.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_INIT, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord));
|
BuildCraftTransport.instance.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_INIT, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSynchronized && CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
if (!isSynchronized && pipe.container.getWorldObj().isRemote) {
|
||||||
isSynchronized = true;
|
isSynchronized = true;
|
||||||
BuildCraftTransport.instance.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord));
|
BuildCraftTransport.instance.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord));
|
||||||
}
|
}
|
||||||
|
@ -249,28 +264,36 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
* SERVER SIDE *
|
* SERVER SIDE *
|
||||||
*/
|
*/
|
||||||
private int calculateTriggerState() {
|
private int calculateTriggerState() {
|
||||||
if (pipe.gate == null)
|
if (pipe.gate == null) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
for (int i = 0; i < triggerState.length; i++) {
|
for (int i = 0; i < triggerState.length; i++) {
|
||||||
if (pipe.gate.triggers[i] != null) {
|
if (pipe.gate.triggers[i] != null) {
|
||||||
triggerState[i] = isNearbyTriggerActive(pipe.gate.triggers[i], pipe.gate.getTriggerParameter(i));
|
triggerState[i] = isNearbyTriggerActive(pipe.gate.triggers[i], pipe.gate.getTriggerParameter(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
state |= triggerState[i] ? 0x01 << i : 0x0;
|
state |= triggerState[i] ? 0x01 << i : 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges() {
|
public void detectAndSendChanges() {
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
|
|
||||||
int state = calculateTriggerState();
|
int state = calculateTriggerState();
|
||||||
|
|
||||||
if (state != lastTriggerState) {
|
if (state != lastTriggerState) {
|
||||||
for (int i = 0; i < this.crafters.size(); i++) {
|
for (int i = 0; i < this.crafters.size(); i++) {
|
||||||
ICrafting viewingPlayer = (ICrafting) this.crafters.get(i);
|
ICrafting viewingPlayer = (ICrafting) this.crafters.get(i);
|
||||||
|
|
||||||
viewingPlayer.sendProgressBarUpdate(this, 0 /* State update */, state);
|
viewingPlayer.sendProgressBarUpdate(this, 0 /* State update */, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTriggerState = state;
|
lastTriggerState = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,13 +310,15 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
private void sendActions(EntityPlayer player) {
|
private void sendActions(EntityPlayer player) {
|
||||||
|
|
||||||
// Compose update packet
|
// Compose update packet
|
||||||
int length = _potentialActions.size();
|
int length = _potentialActions.size();
|
||||||
|
|
||||||
PacketPayloadArrays payload = new PacketPayloadArrays(1, 0, length);
|
PacketPayloadArrays payload = new PacketPayloadArrays(1, 0, length);
|
||||||
|
|
||||||
payload.intPayload[0] = length;
|
payload.intPayload[0] = length;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (IAction action : _potentialActions) {
|
for (IAction action : _potentialActions) {
|
||||||
payload.stringPayload[i++] = action.getUniqueTag();
|
payload.stringPayload[i++] = action.getUniqueTag();
|
||||||
}
|
}
|
||||||
|
@ -310,7 +335,6 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
private void sendTriggers(EntityPlayer player) {
|
private void sendTriggers(EntityPlayer player) {
|
||||||
|
|
||||||
// Compose update packet
|
// Compose update packet
|
||||||
int length = _potentialTriggers.size();
|
int length = _potentialTriggers.size();
|
||||||
PacketPayloadArrays payload = new PacketPayloadArrays(1, 0, length);
|
PacketPayloadArrays payload = new PacketPayloadArrays(1, 0, length);
|
||||||
|
@ -333,13 +357,13 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public void sendSelection(EntityPlayer player) {
|
public void sendSelection(EntityPlayer player) {
|
||||||
if (pipe == null || pipe.gate == null)
|
if (pipe == null || pipe.gate == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int position = 0; position < pipe.gate.material.numSlots; position++) {
|
for (int position = 0; position < pipe.gate.material.numSlots; position++) {
|
||||||
BuildCraftTransport.instance.sendToPlayer(player, new PacketUpdate(PacketIds.GATE_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)));
|
BuildCraftTransport.instance.sendToPlayer(player, new PacketUpdate(PacketIds.GATE_SELECTION, pipe.container.xCoord, pipe.container.yCoord, pipe.container.zCoord, getSelectionPayload(position)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println("Sending current selection to player");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,15 +374,19 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITrigger getFirstTrigger() {
|
public ITrigger getFirstTrigger() {
|
||||||
if (_potentialTriggers.isEmpty())
|
if (_potentialTriggers.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
return _potentialTriggers.first();
|
} else {
|
||||||
|
return _potentialTriggers.first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITrigger getLastTrigger() {
|
public ITrigger getLastTrigger() {
|
||||||
if (_potentialTriggers.isEmpty())
|
if (_potentialTriggers.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
return _potentialTriggers.last();
|
} else {
|
||||||
|
return _potentialTriggers.last();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterator<ITrigger> getTriggerIterator(boolean descending) {
|
public Iterator<ITrigger> getTriggerIterator(boolean descending) {
|
||||||
|
@ -366,25 +394,33 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNearbyTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
public boolean isNearbyTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
||||||
if (pipe.gate == null)
|
if (pipe.gate == null) {
|
||||||
return false;
|
return false;
|
||||||
return pipe.gate.isNearbyTriggerActive(trigger, parameter);
|
} else {
|
||||||
|
return pipe.gate.isNearbyTriggerActive(trigger, parameter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTrigger(int position, ITrigger trigger, boolean notify) {
|
public void setTrigger(int position, ITrigger trigger, boolean notify) {
|
||||||
if (pipe.gate == null)
|
if (pipe.gate == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pipe.gate.setTrigger(position, trigger);
|
pipe.gate.setTrigger(position, trigger);
|
||||||
if (CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj()) && notify) {
|
|
||||||
|
if (pipe.container.getWorldObj().isRemote && notify) {
|
||||||
sendSelectionChange(position);
|
sendSelectionChange(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerParameter(int position, ITriggerParameter parameter, boolean notify) {
|
public void setTriggerParameter(int position, ITriggerParameter parameter, boolean notify) {
|
||||||
if (pipe.gate == null)
|
if (pipe.gate == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pipe.gate.setTriggerParameter(position, parameter);
|
pipe.gate.setTriggerParameter(position, parameter);
|
||||||
if (CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj()) && notify) {
|
|
||||||
|
if (pipe.container.getWorldObj().isRemote && notify) {
|
||||||
sendSelectionChange(position);
|
sendSelectionChange(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,15 +433,19 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAction getFirstAction() {
|
public IAction getFirstAction() {
|
||||||
if (_potentialActions.isEmpty())
|
if (_potentialActions.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
return _potentialActions.first();
|
} else {
|
||||||
|
return _potentialActions.first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAction getLastAction() {
|
public IAction getLastAction() {
|
||||||
if (_potentialActions.isEmpty())
|
if (_potentialActions.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
return _potentialActions.last();
|
} else {
|
||||||
|
return _potentialActions.last();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterator<IAction> getActionIterator(boolean descending) {
|
public Iterator<IAction> getActionIterator(boolean descending) {
|
||||||
|
@ -414,7 +454,8 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
||||||
|
|
||||||
public void setAction(int position, IAction action, boolean notify) {
|
public void setAction(int position, IAction action, boolean notify) {
|
||||||
pipe.gate.setAction(position, action);
|
pipe.gate.setAction(position, action);
|
||||||
if (CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj()) && notify) {
|
|
||||||
|
if (pipe.container.getWorldObj().isRemote && notify) {
|
||||||
sendSelectionChange(position);
|
sendSelectionChange(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class GuiEmeraldPipe extends GuiBuildCraft {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed() {
|
public void onGuiClosed() {
|
||||||
if (CoreProxy.proxy.isRenderWorld(pipe.getWorld())) {
|
if (pipe.getWorld().isRemote) {
|
||||||
pipe.getStateController().setCurrentState(button.getController().getCurrentState());
|
pipe.getStateController().setCurrentState(button.getController().getCurrentState());
|
||||||
PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer());
|
PacketGuiReturn pkt = new PacketGuiReturn(pipe.getContainer());
|
||||||
pkt.sendPacket();
|
pkt.sendPacket();
|
||||||
|
|
|
@ -46,20 +46,24 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
ITrigger trigger = pipe.gate.getTrigger(slot);
|
ITrigger trigger = pipe.gate.getTrigger(slot);
|
||||||
if (trigger != null)
|
|
||||||
|
if (trigger != null) {
|
||||||
return trigger.getDescription();
|
return trigger.getDescription();
|
||||||
else
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon() {
|
public IIcon getIcon() {
|
||||||
ITrigger trigger = pipe.gate.getTrigger(slot);
|
ITrigger trigger = pipe.gate.getTrigger(slot);
|
||||||
if (trigger != null)
|
|
||||||
|
if (trigger != null) {
|
||||||
return trigger.getIcon();
|
return trigger.getIcon();
|
||||||
else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,30 +91,37 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
IAction action = pipe.gate.getAction(slot);
|
IAction action = pipe.gate.getAction(slot);
|
||||||
if (action != null)
|
if (action != null) {
|
||||||
return action.getDescription();
|
return action.getDescription();
|
||||||
else
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon() {
|
public IIcon getIcon() {
|
||||||
IAction action = pipe.gate.getAction(slot);
|
IAction action = pipe.gate.getAction(slot);
|
||||||
if (action != null)
|
|
||||||
|
if (action != null) {
|
||||||
return action.getIcon();
|
return action.getIcon();
|
||||||
else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTexture() {
|
public ResourceLocation getTexture() {
|
||||||
IAction action = pipe.gate.getAction(slot);
|
IAction action = pipe.gate.getAction(slot);
|
||||||
|
|
||||||
if (action instanceof BCAction) {
|
if (action instanceof BCAction) {
|
||||||
BCAction bcAction = (BCAction) action;
|
BCAction bcAction = (BCAction) action;
|
||||||
if (bcAction.getTextureMap() == 0)
|
|
||||||
|
if (bcAction.getTextureMap() == 0) {
|
||||||
return TextureMap.locationBlocksTexture;
|
return TextureMap.locationBlocksTexture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getTexture();
|
return super.getTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,10 +155,12 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
ITriggerParameter parameter = pipe.gate.getTriggerParameter(slot);
|
ITriggerParameter parameter = pipe.gate.getTriggerParameter(slot);
|
||||||
if (parameter != null)
|
|
||||||
|
if (parameter != null) {
|
||||||
return parameter.getItemStack();
|
return parameter.getItemStack();
|
||||||
else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITriggerParameter getTriggerParameter() {
|
public ITriggerParameter getTriggerParameter() {
|
||||||
|
@ -290,8 +303,9 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
||||||
|
|
||||||
AdvancedSlot slot = null;
|
AdvancedSlot slot = null;
|
||||||
|
|
||||||
if (position < 0)
|
if (position < 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
slot = slots[position];
|
slot = slots[position];
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,14 @@ import buildcraft.core.network.PacketIds;
|
||||||
import buildcraft.core.network.PacketSlotChange;
|
import buildcraft.core.network.PacketSlotChange;
|
||||||
import buildcraft.core.network.PacketUpdate;
|
import buildcraft.core.network.PacketUpdate;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
|
import buildcraft.core.utils.Utils;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.PipeTransportPower;
|
import buildcraft.transport.PipeTransportPower;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
import buildcraft.transport.TileGenericPipe;
|
||||||
import buildcraft.transport.gui.ContainerGateInterface;
|
import buildcraft.transport.gui.ContainerGateInterface;
|
||||||
import buildcraft.transport.pipes.PipeItemsDiamond;
|
import buildcraft.transport.pipes.PipeItemsDiamond;
|
||||||
import buildcraft.transport.pipes.PipeItemsEmerald;
|
import buildcraft.transport.pipes.PipeItemsEmerald;
|
||||||
|
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
@ -42,10 +44,8 @@ public class PacketHandlerTransport extends BuildCraftChannelHandler {
|
||||||
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
public void decodeInto(ChannelHandlerContext ctx, ByteBuf data, BuildCraftPacket packet) {
|
||||||
super.decodeInto(ctx, data, packet);
|
super.decodeInto(ctx, data, packet);
|
||||||
try {
|
try {
|
||||||
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||||||
|
EntityPlayer player = Utils.getPlayerFromNetHandler(netHandler);
|
||||||
EntityPlayer player =
|
|
||||||
CoreProxy.proxy.getPlayerFromNetHandler(netHandler);
|
|
||||||
|
|
||||||
int packetID = packet.getID();
|
int packetID = packet.getID();
|
||||||
|
|
||||||
|
@ -82,29 +82,29 @@ public class PacketHandlerTransport extends BuildCraftChannelHandler {
|
||||||
* SERVER SIDE *
|
* SERVER SIDE *
|
||||||
*/
|
*/
|
||||||
case PacketIds.DIAMOND_PIPE_SELECT: {
|
case PacketIds.DIAMOND_PIPE_SELECT: {
|
||||||
onDiamondPipeSelect((EntityPlayer) player, (PacketSlotChange) packet);
|
onDiamondPipeSelect(player, (PacketSlotChange) packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PacketIds.EMERALD_PIPE_SELECT: {
|
case PacketIds.EMERALD_PIPE_SELECT: {
|
||||||
onEmeraldPipeSelect((EntityPlayer) player, (PacketSlotChange) packet);
|
onEmeraldPipeSelect(player, (PacketSlotChange) packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PacketIds.GATE_REQUEST_INIT:
|
case PacketIds.GATE_REQUEST_INIT:
|
||||||
onGateInitRequest((EntityPlayer) player, (PacketCoordinates) packet);
|
onGateInitRequest(player, (PacketCoordinates) packet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketIds.GATE_REQUEST_SELECTION:
|
case PacketIds.GATE_REQUEST_SELECTION:
|
||||||
onGateSelectionRequest((EntityPlayer) player, (PacketCoordinates) packet);
|
onGateSelectionRequest(player, (PacketCoordinates) packet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketIds.GATE_SELECTION_CHANGE:
|
case PacketIds.GATE_SELECTION_CHANGE:
|
||||||
onGateSelectionChange((EntityPlayer) player, (PacketUpdate) packet);
|
onGateSelectionChange(player, (PacketUpdate) packet);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketIds.PIPE_ITEMSTACK_REQUEST: {
|
case PacketIds.PIPE_ITEMSTACK_REQUEST: {
|
||||||
((PacketPipeTransportItemStackRequest) packet).sendDataToPlayer((EntityPlayer) player);
|
((PacketPipeTransportItemStackRequest) packet).sendDataToPlayer(player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,8 +216,9 @@ public class PacketHandlerTransport extends BuildCraftChannelHandler {
|
||||||
* @param packet
|
* @param packet
|
||||||
*/
|
*/
|
||||||
private void onGateSelectionChange(EntityPlayer playerEntity, PacketUpdate packet) {
|
private void onGateSelectionChange(EntityPlayer playerEntity, PacketUpdate packet) {
|
||||||
if (!(playerEntity.openContainer instanceof ContainerGateInterface))
|
if (!(playerEntity.openContainer instanceof ContainerGateInterface)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
((ContainerGateInterface) playerEntity.openContainer).setSelection(packet, true);
|
((ContainerGateInterface) playerEntity.openContainer).setSelection(packet, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class PacketPipeTransportItemStackRequest extends BuildCraftPacket {
|
||||||
|
|
||||||
public void sendDataToPlayer (EntityPlayer player) {
|
public void sendDataToPlayer (EntityPlayer player) {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
BuildCraftTransport.instance.replyToPlayer(
|
BuildCraftTransport.instance.sendToPlayer(
|
||||||
player,
|
player,
|
||||||
new PacketPipeTransportItemStack(travelerID, item
|
new PacketPipeTransportItemStack(travelerID, item
|
||||||
.getItemStack()));
|
.getItemStack()));
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class PipeItemsDiamond extends Pipe<PipeTransportItems> implements IClien
|
||||||
if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe)
|
if (Block.getBlockFromItem(entityplayer.getCurrentEquippedItem().getItem()) instanceof BlockGenericPipe)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(container.getWorldObj())) {
|
if (!container.getWorldObj().isRemote) {
|
||||||
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_DIAMOND, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
|
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_DIAMOND, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class PipeItemsEmerald extends PipeItemsWood implements IClientState, IGu
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(container.getWorldObj())) {
|
if (!container.getWorldObj().isRemote) {
|
||||||
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_EMERALD_ITEM, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
|
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_EMERALD_ITEM, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class PipeItemsEmzuli extends PipeItemsWood implements IGuiReturnHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CoreProxy.proxy.isRenderWorld(container.getWorldObj())) {
|
if (!container.getWorldObj().isRemote) {
|
||||||
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_LOGEMERALD_ITEM, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
|
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_LOGEMERALD_ITEM, container.getWorldObj(), container.xCoord, container.yCoord, container.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,8 +192,9 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> implements IPowe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pullItemIntoPipe(Entity entity, int distance) {
|
public void pullItemIntoPipe(Entity entity, int distance) {
|
||||||
if (CoreProxy.proxy.isRenderWorld(container.getWorldObj()))
|
if (container.getWorldObj().isRemote) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ForgeDirection orientation = getOpenOrientation().getOpposite();
|
ForgeDirection orientation = getOpenOrientation().getOpposite();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public abstract class PipeLogicWood {
|
||||||
protected abstract boolean isValidConnectingTile(TileEntity tile);
|
protected abstract boolean isValidConnectingTile(TileEntity tile);
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
if (!pipe.container.getWorldObj().isRemote) {
|
||||||
switchSourceIfNeeded();
|
switchSourceIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public abstract class PipeLogicWood {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNeighborBlockChange(int blockId) {
|
public void onNeighborBlockChange(int blockId) {
|
||||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.getWorldObj())) {
|
if (!pipe.container.getWorldObj().isRemote) {
|
||||||
switchSourceIfNeeded();
|
switchSourceIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue