Some fixing of assembly table lasers.
This commit is contained in:
parent
8f298b4eb7
commit
a47461a306
45 changed files with 131 additions and 141 deletions
|
@ -39,7 +39,7 @@ import buildcraft.core.BuildCraftConfiguration;
|
|||
import buildcraft.core.CommandBuildCraft;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.EntityEnergyLaser;
|
||||
import buildcraft.core.EntityLaser;
|
||||
import buildcraft.core.EntityPowerLaser;
|
||||
import buildcraft.core.EntityRobot;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.ItemWrench;
|
||||
|
@ -244,10 +244,10 @@ public class BuildCraftCore {
|
|||
loadRecipes();
|
||||
}
|
||||
EntityRegistry.registerModEntity(EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityLaser.class, "bcLaser", EntityIds.LASER, instance, 50, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityPowerLaser.class, "bcLaser", EntityIds.LASER, instance, 50, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityEnergyLaser.class, "bcEnergyLaser", EntityIds.ENERGY_LASER, instance, 50, 1, true);
|
||||
EntityList.classToStringMapping.remove(EntityRobot.class);
|
||||
EntityList.classToStringMapping.remove(EntityLaser.class);
|
||||
EntityList.classToStringMapping.remove(EntityPowerLaser.class);
|
||||
EntityList.classToStringMapping.remove(EntityEnergyLaser.class);
|
||||
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcRobot");
|
||||
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
|
||||
|
|
|
@ -93,7 +93,7 @@ public class BlockArchitect extends BlockContainer {
|
|||
return true;
|
||||
} else {
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
|
||||
return true;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
|||
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k);
|
||||
|
||||
if (!tile.locked || entityplayer.username.equals(tile.owner))
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -104,7 +104,7 @@ public class BlockBuilder extends BlockContainer {
|
|||
return true;
|
||||
} else {
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
|
||||
return true;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockFiller extends BlockContainer {
|
|||
if (entityplayer.isSneaking())
|
||||
return false;
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
|
||||
return true;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj) && box.isInitialized()) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj) && box.isInitialized()) {
|
||||
box.createLasers(worldObj, LaserKind.Stripes);
|
||||
}
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
@Override
|
||||
public void doWork() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
if (a != null) {
|
||||
|
@ -74,7 +74,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
((TileMarker) a).removeFromWorld();
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj) && box.isInitialized()) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj) && box.isInitialized()) {
|
||||
box.createLasers(worldObj, LaserKind.Stripes);
|
||||
}
|
||||
sendNetworkUpdate();
|
||||
|
@ -103,7 +103,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
|
||||
@Override
|
||||
public void doWork() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo
|
|||
}
|
||||
|
||||
public void computeRecipe() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
}
|
||||
|
||||
public void tryConnection() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class TilePathMarker extends TileMarker {
|
|||
|
||||
public void createLaserAndConnect(TilePathMarker pathMarker) {
|
||||
|
||||
if (CoreProxy.proxy.isRemote(worldObj))
|
||||
if (CoreProxy.proxy.isRenderWorld(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));
|
||||
|
|
|
@ -14,11 +14,12 @@ import net.minecraft.src.World;
|
|||
|
||||
public class EntityEnergyLaser extends EntityLaser {
|
||||
|
||||
public static final short POWER_AVERAGING = 100;
|
||||
public int displayStage = 0;
|
||||
|
||||
private final float power [] = new float [100];
|
||||
private final float power [] = new float [POWER_AVERAGING];
|
||||
private int powerIndex = 0;
|
||||
public float powerAverage = 0;
|
||||
private float powerAverage = 0;
|
||||
|
||||
public EntityEnergyLaser(World world) {
|
||||
super(world);
|
||||
|
@ -26,16 +27,13 @@ public class EntityEnergyLaser extends EntityLaser {
|
|||
|
||||
public EntityEnergyLaser(World world, Position head, Position tail) {
|
||||
super(world, head, tail);
|
||||
|
||||
for (int j = 0; j < power.length; ++j)
|
||||
power [j] = 0;
|
||||
}
|
||||
|
||||
public void pushPower (float p) {
|
||||
public void pushPower (float received) {
|
||||
|
||||
powerAverage -= power [powerIndex];
|
||||
powerAverage += p;
|
||||
power[powerIndex] = p;
|
||||
powerAverage += received;
|
||||
power[powerIndex] = received;
|
||||
powerIndex++;
|
||||
|
||||
if (powerIndex == power.length)
|
||||
|
@ -43,7 +41,7 @@ public class EntityEnergyLaser extends EntityLaser {
|
|||
}
|
||||
|
||||
public float getPowerAverage() {
|
||||
return powerAverage / power.length;
|
||||
return powerAverage / POWER_AVERAGING;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
|
||||
package buildcraft.core;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
|
@ -21,7 +16,7 @@ import net.minecraft.src.Entity;
|
|||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
public class EntityLaser extends Entity implements IEntityAdditionalSpawnData {
|
||||
public class EntityLaser extends Entity {
|
||||
|
||||
protected Position head, tail;
|
||||
|
||||
|
@ -31,8 +26,9 @@ public class EntityLaser extends Entity implements IEntityAdditionalSpawnData {
|
|||
protected String texture;
|
||||
|
||||
public EntityLaser(World world) {
|
||||
|
||||
super(world);
|
||||
|
||||
initClientSide();
|
||||
}
|
||||
|
||||
public EntityLaser(World world, Position head, Position tail) {
|
||||
|
@ -44,10 +40,26 @@ public class EntityLaser extends Entity implements IEntityAdditionalSpawnData {
|
|||
|
||||
setPositionAndRotation(head.x, head.y, head.z, 0, 0);
|
||||
|
||||
init();
|
||||
initServerSide();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
protected void initClientSide() {
|
||||
|
||||
head = new Position(0, 0, 0);
|
||||
tail = new Position(0, 0, 0);
|
||||
|
||||
dataWatcher.addObject(8 , Integer.valueOf(0));
|
||||
dataWatcher.addObject(9 , Integer.valueOf(0));
|
||||
dataWatcher.addObject(10, Integer.valueOf(0));
|
||||
dataWatcher.addObject(11, Integer.valueOf(0));
|
||||
dataWatcher.addObject(12, Integer.valueOf(0));
|
||||
dataWatcher.addObject(13, Integer.valueOf(0));
|
||||
|
||||
dataWatcher.addObject(14, Byte.valueOf((byte) 0));
|
||||
|
||||
}
|
||||
|
||||
protected void initServerSide() {
|
||||
|
||||
preventEntitySpawning = false;
|
||||
noClip = true;
|
||||
|
@ -66,32 +78,14 @@ public class EntityLaser extends Entity implements IEntityAdditionalSpawnData {
|
|||
dataWatcher.addObject(14, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSpawnData(ByteArrayDataOutput data) {
|
||||
data.writeDouble(head.x);
|
||||
data.writeDouble(head.y);
|
||||
data.writeDouble(head.z);
|
||||
data.writeDouble(tail.x);
|
||||
data.writeDouble(tail.y);
|
||||
data.writeDouble(tail.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSpawnData(ByteArrayDataInput data) {
|
||||
head = new Position(data.readDouble(), data.readDouble(), data.readDouble());
|
||||
tail = new Position(data.readDouble(), data.readDouble(), data.readDouble());
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
if (head == null || tail == null)
|
||||
return;
|
||||
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
updateData();
|
||||
}
|
||||
|
||||
boundingBox.minX = Math.min(head.x, tail.x);
|
||||
boundingBox.minY = Math.min(head.y, tail.y);
|
||||
|
@ -128,15 +122,7 @@ public class EntityLaser extends Entity implements IEntityAdditionalSpawnData {
|
|||
tail.y = decodeDouble(dataWatcher.getWatchableObjectInt(12));
|
||||
tail.z = decodeDouble(dataWatcher.getWatchableObjectInt(13));
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public void setPosition(double x, double y, double z) {
|
||||
//
|
||||
// posX = x;
|
||||
// posY = y;
|
||||
// posZ = z;
|
||||
// }
|
||||
//
|
||||
|
||||
public void setPositions(Position head, Position tail) {
|
||||
|
||||
this.head = head;
|
||||
|
|
|
@ -289,7 +289,7 @@ public class EntityPassiveItem implements IPipedItem {
|
|||
*/
|
||||
@Override
|
||||
public EntityItem toEntityItem(Orientations dir) {
|
||||
if (!CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (getItemStack().stackSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
16
common/buildcraft/core/EntityPowerLaser.java
Normal file
16
common/buildcraft/core/EntityPowerLaser.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import net.minecraft.src.World;
|
||||
import buildcraft.api.core.Position;
|
||||
|
||||
public class EntityPowerLaser extends EntityLaser {
|
||||
|
||||
public EntityPowerLaser(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityPowerLaser(World world, Position head, Position tail) {
|
||||
super(world, head, tail);
|
||||
}
|
||||
|
||||
}
|
|
@ -140,7 +140,7 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData {
|
|||
|
||||
if (reachedDesination()) {
|
||||
|
||||
BlockIndex newDesination = getNewDesination();
|
||||
BlockIndex newDesination = getNewDestination();
|
||||
if (newDesination != null) {
|
||||
setDestination(newDesination.i, newDesination.j, newDesination.k);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData {
|
|||
|
||||
}
|
||||
|
||||
protected BlockIndex getNewDesination() {
|
||||
protected BlockIndex getNewDestination() {
|
||||
|
||||
Box movementBoundary = new Box();
|
||||
movementBoundary.initialize(box);
|
||||
|
@ -206,7 +206,7 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData {
|
|||
BptSlot target = a.slot;
|
||||
if (wait <= 0) {
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
|
||||
if (target.mode == Mode.ClearIfInvalid) {
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class CoreProxy {
|
|||
return !world.isRemote;
|
||||
}
|
||||
|
||||
public boolean isRemote(World world) {
|
||||
public boolean isRenderWorld(World world) {
|
||||
return world.isRemote;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import buildcraft.BuildCraftCore;
|
|||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import buildcraft.core.EntityEnergyLaser;
|
||||
import buildcraft.core.EntityLaser;
|
||||
import buildcraft.core.EntityPowerLaser;
|
||||
import buildcraft.core.EntityRobot;
|
||||
import buildcraft.core.render.RenderEnergyLaser;
|
||||
import buildcraft.core.render.RenderEntityBlock;
|
||||
|
@ -62,7 +62,7 @@ public class CoreProxyClient extends CoreProxy {
|
|||
public void removeEntity(Entity entity) {
|
||||
super.removeEntity(entity);
|
||||
|
||||
if (isRemote(entity.worldObj))
|
||||
if (isRenderWorld(entity.worldObj))
|
||||
((WorldClient) entity.worldObj).removeEntityFromWorld(entity.entityId);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class CoreProxyClient extends CoreProxy {
|
|||
@Override
|
||||
public void initializeEntityRendering() {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBlock.class, new RenderEntityBlock());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityPowerLaser.class, new RenderLaser());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyLaser.class, new RenderEnergyLaser());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRobot.class, new RenderRobot());
|
||||
}
|
||||
|
|
|
@ -382,7 +382,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 && !CoreProxy.proxy.isRemote(world))
|
||||
if (tile instanceof IInventory && !CoreProxy.proxy.isRenderWorld(world))
|
||||
if (!(tile instanceof IDropControlInventory) || ((IDropControlInventory) tile).doDrop())
|
||||
dropItems(world, (IInventory) tile, i, j, k);
|
||||
|
||||
|
|
|
@ -92,12 +92,12 @@ public class BlockEngine extends BlockContainer {
|
|||
return false;
|
||||
|
||||
if (tile.engine instanceof EngineStone) {
|
||||
if (!CoreProxy.proxy.isRemote(tile.worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(tile.worldObj))
|
||||
entityplayer.openGui(BuildCraftEnergy.instance, GuiIds.ENGINE_STONE, world, i, j, k);
|
||||
return true;
|
||||
|
||||
} else if (tile.engine instanceof EngineIron) {
|
||||
if (!CoreProxy.proxy.isRemote(tile.worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(tile.worldObj))
|
||||
entityplayer.openGui(BuildCraftEnergy.instance, GuiIds.ENGINE_IRON, world, i, j, k);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class Engine {
|
|||
}
|
||||
|
||||
public final EnergyStage getEnergyStage() {
|
||||
if (!CoreProxy.proxy.isRemote(tile.worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(tile.worldObj)) {
|
||||
computeEnergyStage();
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
if (!CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (engine == null) {
|
||||
createEngineIfNeeded();
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
return;
|
||||
}
|
||||
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (progressPart != 0) {
|
||||
engine.progress += serverPistonSpeed;
|
||||
|
||||
|
@ -362,7 +362,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
|||
|
||||
@Override
|
||||
public void doWork() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class BlockAutoWorkbench extends BlockBuildCraft {
|
|||
}
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.AUTO_CRAFTING_TABLE, world, i, j, k);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BlockHopper extends BlockBuildCraft {
|
|||
}
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.HOPPER, world, x, y, z);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -129,7 +129,7 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
@Override
|
||||
public void breakBlock(World world, int i, int j, int k, int par5, int par6) {
|
||||
|
||||
if (CoreProxy.proxy.isRemote(world)){
|
||||
if (CoreProxy.proxy.isRenderWorld(world)){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ public class BlockRefinery extends BlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftFactory.instance, GuiIds.REFINERY, world, i, j, k);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
|
||||
package buildcraft.factory;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.core.EntityBlock;
|
||||
import net.minecraft.src.Entity;
|
||||
|
@ -33,7 +29,6 @@ public class EntityMechanicalArm extends Entity {
|
|||
private double xRoot;
|
||||
private double yRoot;
|
||||
private double zRoot;
|
||||
private double angle;
|
||||
|
||||
private int headX, headY, headZ;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class TileHopper extends TileBuildCraft implements IInventory {
|
|||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (CoreProxy.proxy.isRemote(worldObj) || worldObj.getWorldTime() % 5 != 0)
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj) || worldObj.getWorldTime() % 5 != 0)
|
||||
return;
|
||||
int internalSlot = _internalInventory.getIdForFirstSlot();
|
||||
if (internalSlot < 0)
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (tube.posY - aimY > 0.01) {
|
||||
tubeY = tube.posY - 0.01;
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ import net.minecraft.src.Block;
|
|||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.MathHelper;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
|
||||
public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, IPipeConnection, IBuilderInventory {
|
||||
|
@ -88,9 +87,8 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
|
||||
box.deleteLasers();
|
||||
|
||||
if (arm == null) {
|
||||
if (arm == null)
|
||||
createArm();
|
||||
}
|
||||
|
||||
if (findTarget(false)) {
|
||||
isDigging = true;
|
||||
|
@ -340,7 +338,6 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor,
|
|||
|
||||
public void positionReached() {
|
||||
inProcess = false;
|
||||
System.out.println("PositionReached!" + Thread.currentThread());
|
||||
|
||||
if (worldObj.isRemote) {
|
||||
return;
|
||||
|
|
|
@ -165,7 +165,7 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
simpleAnimationIterate();
|
||||
} else if (CoreProxy.proxy.isSimulating(worldObj) && updateNetworkTime.markTimeIfDelay(worldObj, 2 * BuildCraftCore.updateFactor)) {
|
||||
sendNetworkUpdate();
|
||||
|
|
|
@ -39,7 +39,7 @@ public class TileTank extends TileBuildCraft implements ITankContainer
|
|||
hasUpdate = false;
|
||||
}
|
||||
|
||||
if(CoreProxy.proxy.isRemote(worldObj)) {
|
||||
if(CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ContainerRefinery extends BuildCraftContainer {
|
|||
|
||||
refinery.setFilter(slot, liquidId);
|
||||
|
||||
if (CoreProxy.proxy.isRemote(refinery.worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(refinery.worldObj)) {
|
||||
PacketPayload payload = new PacketPayload(3, 0, 0);
|
||||
payload.intPayload[0] = slot;
|
||||
payload.intPayload[1] = liquidId;
|
||||
|
|
|
@ -49,7 +49,7 @@ public class BlockAssemblyTable extends BlockContainer {
|
|||
if (entityplayer.isSneaking())
|
||||
return false;
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
entityplayer.openGui(BuildCraftSilicon.instance, GuiIds.ASSEMBLY_TABLE, world, i, j, k);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
private int nextNetworkUpdate = 3;
|
||||
private int nextLaserUpdate = 10;
|
||||
private int nextLaserSearch = 10;
|
||||
|
||||
|
||||
public TileLaser() {
|
||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||
powerProvider.configure(20, 25, 25, 25, 1000);
|
||||
|
@ -50,37 +50,42 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!CoreProxy.proxy.isSimulating(worldObj))
|
||||
return;
|
||||
|
||||
// Disable the laser and do nothing if no energy is available.
|
||||
if (powerProvider.getEnergyStored() == 0) {
|
||||
removeLaser();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValidTable()) {
|
||||
|
||||
if (canFindTable()) {
|
||||
// Check for available tables if none is linked to this laser.
|
||||
if (!isValidTable())
|
||||
if (canFindTable())
|
||||
findTable();
|
||||
}
|
||||
}
|
||||
|
||||
// If we still don't have a valid table or the existing has
|
||||
// become invalid, we disable the laser and do nothing.
|
||||
if (!isValidTable()) {
|
||||
removeLaser();
|
||||
return;
|
||||
}
|
||||
|
||||
if (laser == null) {
|
||||
// We have a table and can work, so we create a laser if
|
||||
// necessary.
|
||||
if (laser == null)
|
||||
createLaser();
|
||||
}
|
||||
|
||||
if (laser != null && canUpdateLaser()) {
|
||||
// We have a laser and may update it
|
||||
if (laser != null && canUpdateLaser())
|
||||
updateLaser();
|
||||
}
|
||||
|
||||
float p = powerProvider.useEnergy(0, 4, true);
|
||||
assemblyTable.receiveLaserEnergy(p);
|
||||
// Consume power and transfer it to the table.
|
||||
float power = powerProvider.useEnergy(0, 4, true);
|
||||
assemblyTable.receiveLaserEnergy(power);
|
||||
|
||||
if (laser != null) {
|
||||
laser.pushPower(p);
|
||||
}
|
||||
if (laser != null)
|
||||
laser.pushPower(power);
|
||||
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
@ -95,9 +100,8 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
|
||||
protected boolean isValidTable() {
|
||||
|
||||
if (assemblyTable == null || assemblyTable.isInvalid() || assemblyTable.currentRecipe == null) {
|
||||
if (assemblyTable == null || assemblyTable.isInvalid() || assemblyTable.currentRecipe == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -164,9 +168,6 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
|
||||
protected void createLaser() {
|
||||
|
||||
if (CoreProxy.proxy.isSimulating(worldObj))
|
||||
return;
|
||||
|
||||
laser = new EntityEnergyLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord, zCoord));
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
}
|
||||
|
@ -220,7 +221,6 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
@Override
|
||||
public void setPowerProvider(IPowerProvider provider) {
|
||||
powerProvider = provider;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -241,11 +241,9 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendNetworkUpdate() {
|
||||
|
||||
if (networkTracker.markTimeIfDelay(worldObj, nextNetworkUpdate)) {
|
||||
public void sendNetworkUpdate() {
|
||||
if (networkTracker.markTimeIfDelay(worldObj, nextNetworkUpdate))
|
||||
super.sendNetworkUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,7 +70,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
updateRecipes();
|
||||
|
||||
// Request current selection from server
|
||||
if(CoreProxy.proxy.isRemote(assemblyTable.worldObj))
|
||||
if(CoreProxy.proxy.isRenderWorld(assemblyTable.worldObj))
|
||||
CoreProxy.proxy.sendToServer(new PacketCoordinates(PacketIds.SELECTION_ASSEMBLY_GET, assemblyTable.xCoord,
|
||||
assemblyTable.yCoord, assemblyTable.zCoord).getPacket());
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
|
||||
ContainerAssemblyTable container = (ContainerAssemblyTable) inventorySlots;
|
||||
|
||||
if (CoreProxy.proxy.isRemote(assemblyTable.worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(assemblyTable.worldObj)) {
|
||||
PacketPayload payload = TileAssemblyTable.selectionMessageWrapper.toPayload(container.x, container.y,
|
||||
container.z, message);
|
||||
|
||||
|
|
|
@ -219,7 +219,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 (CoreProxy.proxy.isRemote(world))
|
||||
if (CoreProxy.proxy.isRenderWorld(world))
|
||||
return;
|
||||
|
||||
int i1 = quantityDropped(world.rand);
|
||||
|
@ -370,7 +370,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
// Try to strip wires first, starting with yellow.
|
||||
for (IPipe.WireColor color : IPipe.WireColor.values())
|
||||
if (pipe.wireSet[color.reverse().ordinal()]) {
|
||||
if (!CoreProxy.proxy.isRemote(pipe.worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(pipe.worldObj))
|
||||
dropWire(color.reverse(), pipe.worldObj, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
pipe.wireSet[color.reverse().ordinal()] = false;
|
||||
//pipe.worldObj.markBlockNeedsUpdate(pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
|
@ -380,7 +380,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
// Try to strip gate next
|
||||
if (pipe.hasGate()) {
|
||||
if (!CoreProxy.proxy.isRemote(pipe.worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(pipe.worldObj))
|
||||
pipe.gate.dropGate(pipe.worldObj, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
pipe.resetGate();
|
||||
return true;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class GateVanilla extends Gate {
|
|||
// GUI
|
||||
@Override
|
||||
public void openGui(EntityPlayer player) {
|
||||
if (!CoreProxy.proxy.isRemote(player.worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(player.worldObj))
|
||||
player.openGui(BuildCraftTransport.instance, GuiIds.GATES, pipe.worldObj, pipe.xCoord, pipe.yCoord, pipe.zCoord);
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ public class PipeTransportItems extends PipeTransport {
|
|||
} else if (tile instanceof IInventory) {
|
||||
ItemStack added = Transactor.getTransactorFor(tile).add(data.item.getItemStack(), data.orientation.reverse(), true);
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
if(added.stackSize >= data.item.getItemStack().stackSize)
|
||||
data.item.remove();
|
||||
else {
|
||||
|
@ -360,7 +360,7 @@ public class PipeTransportItems extends PipeTransport {
|
|||
else {
|
||||
int i;
|
||||
|
||||
if (CoreProxy.proxy.isRemote(worldObj) || CoreProxy.proxy.isSimulating(worldObj))
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj) || CoreProxy.proxy.isSimulating(worldObj))
|
||||
{
|
||||
i = Math.abs(data.item.getEntityId() + xCoord + yCoord + zCoord + data.item.getDeterministicRandomization())
|
||||
% listOfPossibleMovements.size();
|
||||
|
|
|
@ -178,7 +178,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj))
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
|
||||
moveLiquids();
|
||||
|
|
|
@ -50,7 +50,7 @@ public class PipeTransportPower extends PipeTransport {
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (CoreProxy.proxy.isRemote(worldObj))
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
|
||||
step();
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
|
||||
// Do not attempt to create a list of potential actions and triggers on
|
||||
// the client.
|
||||
if (!CoreProxy.proxy.isRemote(pipe.worldObj)) {
|
||||
if (!CoreProxy.proxy.isRenderWorld(pipe.worldObj)) {
|
||||
_potentialActions.addAll(pipe.getActions());
|
||||
_potentialTriggers.addAll(ActionManager.getPipeTriggers(pipe));
|
||||
|
||||
|
@ -198,13 +198,13 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
*/
|
||||
public void synchronize() {
|
||||
|
||||
if (!isNetInitialized && CoreProxy.proxy.isRemote(pipe.worldObj)) {
|
||||
if (!isNetInitialized && CoreProxy.proxy.isRenderWorld(pipe.worldObj)) {
|
||||
isNetInitialized = true;
|
||||
CoreProxy.proxy.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_INIT, pipe.xCoord, pipe.yCoord, pipe.zCoord)
|
||||
.getPacket());
|
||||
}
|
||||
|
||||
if (!isSynchronized && CoreProxy.proxy.isRemote(pipe.worldObj)) {
|
||||
if (!isSynchronized && CoreProxy.proxy.isRenderWorld(pipe.worldObj)) {
|
||||
isSynchronized = true;
|
||||
CoreProxy.proxy.sendToServer(new PacketCoordinates(PacketIds.GATE_REQUEST_SELECTION, pipe.xCoord, pipe.yCoord, pipe.zCoord)
|
||||
.getPacket());
|
||||
|
@ -374,13 +374,13 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
|
||||
public void setTrigger(int position, ITrigger trigger, boolean notify) {
|
||||
pipe.setTrigger(position, trigger);
|
||||
if (CoreProxy.proxy.isRemote(pipe.worldObj) && notify)
|
||||
if (CoreProxy.proxy.isRenderWorld(pipe.worldObj) && notify)
|
||||
sendSelectionChange(position);
|
||||
}
|
||||
|
||||
public void setTriggerParameter(int position, ITriggerParameter parameter, boolean notify) {
|
||||
pipe.setTriggerParameter(position, parameter);
|
||||
if (CoreProxy.proxy.isRemote(pipe.worldObj) && notify)
|
||||
if (CoreProxy.proxy.isRenderWorld(pipe.worldObj) && notify)
|
||||
sendSelectionChange(position);
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
|
||||
public void setAction(int position, IAction action, boolean notify) {
|
||||
pipe.setAction(position, action);
|
||||
if (CoreProxy.proxy.isRemote(pipe.worldObj) && notify)
|
||||
if (CoreProxy.proxy.isRenderWorld(pipe.worldObj) && notify)
|
||||
sendSelectionChange(position);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class GuiDiamondPipe extends GuiAdvancedInterface {
|
|||
|
||||
filterInventory.setInventorySlotContents(position, newStack);
|
||||
|
||||
if (CoreProxy.proxy.isRemote(filterInventory.worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(filterInventory.worldObj)) {
|
||||
PacketSlotChange packet = new PacketSlotChange(PacketIds.DIAMOND_PIPE_SELECT, filterInventory.xCoord,
|
||||
filterInventory.yCoord, filterInventory.zCoord, position, newStack);
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
|
|
|
@ -201,7 +201,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
|
||||
public void pullItemIntoPipe(Entity entity, int distance) {
|
||||
if (CoreProxy.proxy.isRemote(worldObj))
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
|
||||
Orientations orientation = getOpenOrientation().reverse();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
|
|||
if (Block.blocksList[entityplayer.getCurrentEquippedItem().itemID] instanceof BlockGenericPipe)
|
||||
return false;
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(container.worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(container.worldObj))
|
||||
entityplayer.openGui(BuildCraftTransport.instance, GuiIds.PIPE_DIAMOND, container.worldObj, container.xCoord, container.yCoord, container.zCoord);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class PipeLogicWood extends PipeLogic {
|
|||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
switchSourceIfNeeded();
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class PipeLogicWood extends PipeLogic {
|
|||
public void onNeighborBlockChange(int blockId) {
|
||||
super.onNeighborBlockChange(blockId);
|
||||
|
||||
if (!CoreProxy.proxy.isRemote(worldObj))
|
||||
if (!CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
switchSourceIfNeeded();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue