Eliminated isClient().

This commit is contained in:
SirSengir 2012-08-18 11:57:24 +02:00
parent c724e960f1
commit b87d8fd817
35 changed files with 59 additions and 64 deletions

View file

@ -92,7 +92,7 @@ public class BlockArchitect extends BlockContainer {
return true;
} else {
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
return true;

View file

@ -48,7 +48,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k);
if (!tile.locked || entityplayer.username.equals(tile.owner))
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
return true;

View file

@ -105,7 +105,7 @@ public class BlockBuilder extends BlockContainer {
return true;
} else {
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
return true;

View file

@ -51,7 +51,7 @@ public class BlockFiller extends BlockContainer {
if (entityplayer.isSneaking())
return false;
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
return true;

View file

@ -72,7 +72,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
}
}
if (!ProxyCore.proxy.isClient(worldObj) && box.isInitialized()) {
if (!ProxyCore.proxy.isRemote(worldObj) && box.isInitialized()) {
box.createLasers(worldObj, LaserKind.Stripes);
}

View file

@ -279,7 +279,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
@Override
public void doWork() {
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
return;
}
@ -588,7 +588,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
box.deleteLasers();
box.reset();
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}

View file

@ -63,7 +63,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
public void initialize() {
super.initialize();
if (!ProxyCore.proxy.isClient(worldObj)) {
if (!ProxyCore.proxy.isRemote(worldObj)) {
IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord, yCoord, zCoord);
if (a != null) {
@ -73,7 +73,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
((TileMarker) a).removeFromWorld();
}
if (!ProxyCore.proxy.isClient(worldObj) && box.isInitialized()) {
if (!ProxyCore.proxy.isRemote(worldObj) && box.isInitialized()) {
box.createLasers(worldObj, LaserKind.Stripes);
}
sendNetworkUpdate();
@ -102,7 +102,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
@Override
public void doWork() {
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
return;
}
@ -156,7 +156,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
}
public void computeRecipe() {
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
return;
}
@ -185,7 +185,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
currentPatternId = currentPattern.getId();
}
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}
}

View file

@ -124,7 +124,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
}
}
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}
}
@ -153,7 +153,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
}
public void tryConnection() {
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
return;
}
@ -394,7 +394,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
signals = null;
if (ProxyCore.proxy.isServerSide(worldObj) && markerOrigin != null && markerOrigin != this) {
if (ProxyCore.proxy.isSimulating(worldObj) && markerOrigin != null && markerOrigin != this) {
markerOrigin.sendNetworkUpdate();
}
}

View file

@ -55,7 +55,7 @@ public class TilePathMarker extends TileMarker {
public void createLaserAndConnect(TilePathMarker pathMarker) {
if (ProxyCore.proxy.isClient(worldObj))
if (ProxyCore.proxy.isRemote(worldObj))
return;
EntityLaser laser = new EntityLaser(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));

View file

@ -90,7 +90,7 @@ public class EntityLaser extends Entity implements ISpawnHandler {
if (head == null || tail == null)
return;
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
updateData();
}

View file

@ -288,7 +288,7 @@ public class EntityPassiveItem implements IPipedItem {
*/
@Override
public EntityItem toEntityItem(Orientations dir) {
if (!ProxyCore.proxy.isClient(worldObj)) {
if (!ProxyCore.proxy.isRemote(worldObj)) {
if (getItemStack().stackSize <= 0) {
return null;
}

View file

@ -198,7 +198,7 @@ public class EntityRobot extends Entity implements ISpawnHandler {
BptSlot target = a.slot;
if (wait <= 0) {
if (!ProxyCore.proxy.isClient(worldObj)) {
if (!ProxyCore.proxy.isRemote(worldObj)) {
if (target.mode == Mode.ClearIfInvalid) {

View file

@ -12,7 +12,6 @@ package buildcraft.core;
import java.io.File;
import java.util.Random;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.SidedProxy;
import buildcraft.core.network.BuildCraftPacket;
@ -36,11 +35,7 @@ public class ProxyCore {
public static ProxyCore proxy;
/* SIMULATION */
public boolean isClient(World world) {
return isRemote(world);
}
public boolean isServerSide(World world) {
public boolean isSimulating(World world) {
return !world.isRemote;
}

View file

@ -375,7 +375,7 @@ public class Utils {
public static void preDestroyBlock(World world, int i, int j, int k) {
TileEntity tile = world.getBlockTileEntity(i, j, k);
if (tile instanceof IInventory && !ProxyCore.proxy.isClient(world))
if (tile instanceof IInventory && !ProxyCore.proxy.isRemote(world))
if (!(tile instanceof IDropControlInventory) || ((IDropControlInventory) tile).doDrop())
dropItems(world, (IInventory) tile, i, j, k);

View file

@ -91,12 +91,12 @@ public class BlockEngine extends BlockContainer {
return false;
if (tile.engine instanceof EngineStone) {
if (!ProxyCore.proxy.isClient(tile.worldObj))
if (!ProxyCore.proxy.isRemote(tile.worldObj))
entityplayer.openGui(mod_BuildCraftEnergy.instance, GuiIds.ENGINE_STONE, world, i, j, k);
return true;
} else if (tile.engine instanceof EngineIron) {
if (!ProxyCore.proxy.isClient(tile.worldObj))
if (!ProxyCore.proxy.isRemote(tile.worldObj))
entityplayer.openGui(mod_BuildCraftEnergy.instance, GuiIds.ENGINE_IRON, world, i, j, k);
return true;
}

View file

@ -58,7 +58,7 @@ public abstract class Engine {
}
public final EnergyStage getEnergyStage() {
if (!ProxyCore.proxy.isClient(tile.worldObj)) {
if (!ProxyCore.proxy.isRemote(tile.worldObj)) {
computeEnergyStage();
}

View file

@ -66,7 +66,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
@Override
public void initialize() {
if (!ProxyCore.proxy.isClient(worldObj)) {
if (!ProxyCore.proxy.isRemote(worldObj)) {
if (engine == null) {
createEngineIfNeeded();
}
@ -85,7 +85,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
return;
}
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
if (progressPart != 0) {
engine.progress += serverPistonSpeed;
@ -362,7 +362,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
@Override
public void doWork() {
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
return;
}

View file

@ -58,7 +58,7 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
}
}
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftFactory.instance, GuiIds.AUTO_CRAFTING_TABLE, world, i, j, k);
return true;

View file

@ -61,7 +61,7 @@ public class BlockHopper extends BlockBuildCraft {
}
}
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftFactory.instance, GuiIds.HOPPER, world, x, y, z);
return true;

View file

@ -118,7 +118,7 @@ public class BlockRefinery extends BlockContainer {
}
}
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftFactory.instance, GuiIds.REFINERY, world, i, j, k);
return true;

View file

@ -37,7 +37,7 @@ public class TileHopper extends TileBuildCraft implements IInventory {
@Override
public void updateEntity() {
super.updateEntity();
if (ProxyCore.proxy.isClient(worldObj) || worldObj.getWorldTime() % 5 != 0)
if (ProxyCore.proxy.isRemote(worldObj) || worldObj.getWorldTime() % 5 != 0)
return;
int internalSlot = _internalInventory.getIdForFirstSlot();
if (internalSlot < 0)

View file

@ -66,13 +66,13 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
return;
}
if (!ProxyCore.proxy.isClient(worldObj)) {
if (!ProxyCore.proxy.isRemote(worldObj)) {
if (tube.posY - aimY > 0.01) {
tubeY = tube.posY - 0.01;
setTubePosition();
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}
@ -97,7 +97,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
internalLiquid = internalLiquid += BuildCraftAPI.BUCKET_VOLUME;
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}
}
@ -160,7 +160,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
worldObj.spawnEntityInWorld(tube);
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}
}

View file

@ -82,7 +82,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
public void createUtilsIfNeeded() {
if (!box.isInitialized() && ProxyCore.proxy.isClient(worldObj)) {
if (!box.isInitialized() && ProxyCore.proxy.isRemote(worldObj)) {
return;
}
@ -168,7 +168,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
speed = arm.speed;
}
if (ProxyCore.proxy.isServerSide(worldObj)) {
if (ProxyCore.proxy.isSimulating(worldObj)) {
sendNetworkUpdate();
}
@ -248,7 +248,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
public boolean findTarget(boolean doSet) {
if (ProxyCore.proxy.isClient(worldObj))
if (ProxyCore.proxy.isRemote(worldObj))
return false;
boolean[][] blockedColumns = new boolean[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2];
@ -377,7 +377,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
public void positionReached(EntityMechanicalArm arm) {
inProcess = false;
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
return;
}
@ -609,7 +609,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
public void initialize() {
super.initialize();
if (!ProxyCore.proxy.isClient(worldObj)) {
if (!ProxyCore.proxy.isRemote(worldObj)) {
createUtilsIfNeeded();
}

View file

@ -165,9 +165,9 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
@Override
public void updateEntity() {
if (ProxyCore.proxy.isClient(worldObj)) {
if (ProxyCore.proxy.isRemote(worldObj)) {
simpleAnimationIterate();
} else if (ProxyCore.proxy.isServerSide(worldObj) && updateNetworkTime.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
} else if (ProxyCore.proxy.isSimulating(worldObj) && updateNetworkTime.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
sendNetworkUpdate();
}

View file

@ -34,7 +34,7 @@ public class TileTank extends TileBuildCraft implements ITankContainer
@Override
public void updateEntity()
{
if(ProxyCore.proxy.isServerSide(worldObj) && hasUpdate && tracker.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
if(ProxyCore.proxy.isSimulating(worldObj) && hasUpdate && tracker.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
sendNetworkUpdate();
hasUpdate = false;
}

View file

@ -48,7 +48,7 @@ public class BlockAssemblyTable extends BlockContainer {
if (entityplayer.isSneaking())
return false;
if (!ProxyCore.proxy.isClient(world))
if (!ProxyCore.proxy.isRemote(world))
entityplayer.openGui(mod_BuildCraftSilicon.instance, GuiIds.ASSEMBLY_TABLE, world, i, j, k);
return true;
}

View file

@ -164,7 +164,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
protected void createLaser() {
if (ProxyCore.proxy.isServerSide(worldObj))
if (ProxyCore.proxy.isSimulating(worldObj))
return;
laser = new EntityEnergyLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord, zCoord));

View file

@ -216,7 +216,7 @@ public class BlockGenericPipe extends BlockContainer {
@Override
public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int dmg) {
if (ProxyCore.proxy.isClient(world))
if (ProxyCore.proxy.isRemote(world))
return;
int i1 = quantityDropped(world.rand);

View file

@ -62,7 +62,7 @@ public class GateVanilla extends Gate {
// GUI
@Override
public void openGui(EntityPlayer player) {
if (!ProxyCore.proxy.isClient(player.worldObj))
if (!ProxyCore.proxy.isRemote(player.worldObj))
player.openGui(mod_BuildCraftTransport.instance, GuiIds.GATES, pipe.worldObj, pipe.xCoord, pipe.yCoord, pipe.zCoord);
}

View file

@ -41,7 +41,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
if (Block.blocksList[entityplayer.getCurrentEquippedItem().itemID] instanceof BlockGenericPipe)
return false;
if (!ProxyCore.proxy.isClient(container.worldObj))
if (!ProxyCore.proxy.isRemote(container.worldObj))
entityplayer.openGui(mod_BuildCraftTransport.instance, GuiIds.PIPE_DIAMOND, container.worldObj, container.xCoord,
container.yCoord, container.zCoord);
@ -52,7 +52,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
@Override
public void updateEntity() {
if (tracker.markTimeIfDelay(worldObj, 20 * BuildCraftCore.updateFactor))
if (ProxyCore.proxy.isServerSide(container.worldObj))
if (ProxyCore.proxy.isSimulating(container.worldObj))
sendFilterSet();
}
@ -94,7 +94,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
public ItemStack decrStackSize(int i, int j) {
ItemStack stack = filters.decrStackSize(i, j);
if (ProxyCore.proxy.isServerSide(container.worldObj))
if (ProxyCore.proxy.isSimulating(container.worldObj))
sendFilterSet();
return stack;
@ -104,7 +104,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
public void setInventorySlotContents(int i, ItemStack itemstack) {
filters.setInventorySlotContents(i, itemstack);
if (ProxyCore.proxy.isServerSide(container.worldObj))
if (ProxyCore.proxy.isSimulating(container.worldObj))
sendFilterSet();
}

View file

@ -82,7 +82,7 @@ public class PipeLogicWood extends PipeLogic {
public void initialize() {
super.initialize();
if (!ProxyCore.proxy.isClient(worldObj))
if (!ProxyCore.proxy.isRemote(worldObj))
switchSourceIfNeeded();
}
@ -103,7 +103,7 @@ public class PipeLogicWood extends PipeLogic {
public void onNeighborBlockChange(int blockId) {
super.onNeighborBlockChange(blockId);
if (!ProxyCore.proxy.isClient(worldObj))
if (!ProxyCore.proxy.isRemote(worldObj))
switchSourceIfNeeded();
}

View file

@ -256,7 +256,7 @@ public class PipeTransportItems extends PipeTransport {
} else if (tile instanceof IInventory) {
StackUtil utils = new StackUtil(data.item.getItemStack());
if (!ProxyCore.proxy.isClient(worldObj))
if (!ProxyCore.proxy.isRemote(worldObj))
if (utils.checkAvailableSlot((IInventory) tile, true, data.orientation.reverse()) && utils.items.stackSize == 0)
data.item.remove();
else {
@ -359,7 +359,7 @@ public class PipeTransportItems extends PipeTransport {
else {
int i;
if (ProxyCore.proxy.isClient(worldObj) || ProxyCore.proxy.isServerSide(worldObj))
if (ProxyCore.proxy.isRemote(worldObj) || ProxyCore.proxy.isSimulating(worldObj))
{
i = Math.abs(data.item.getEntityId() + xCoord + yCoord + zCoord + data.item.getDeterministicRandomization())
% listOfPossibleMovements.size();

View file

@ -177,7 +177,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
@Override
public void updateEntity() {
if (ProxyCore.proxy.isClient(worldObj))
if (ProxyCore.proxy.isRemote(worldObj))
return;
moveLiquids();
@ -212,7 +212,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
}
if (ProxyCore.proxy.isServerSide(worldObj))
if (ProxyCore.proxy.isSimulating(worldObj))
if (tracker.markTimeIfDelay(worldObj, 1 * BuildCraftCore.updateFactor)){
PacketLiquidUpdate packet = new PacketLiquidUpdate(xCoord, yCoord, zCoord);

View file

@ -49,7 +49,7 @@ public class PipeTransportPower extends PipeTransport {
@Override
public void updateEntity() {
if (ProxyCore.proxy.isClient(worldObj))
if (ProxyCore.proxy.isRemote(worldObj))
return;
step();

View file

@ -202,7 +202,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
}
public void pullItemIntoPipe(Entity entity, int distance) {
if (ProxyCore.proxy.isClient(worldObj))
if (ProxyCore.proxy.isRemote(worldObj))
return;
Orientations orientation = getOpenOrientation().reverse();