parent
df7b082c25
commit
742c20cc45
7 changed files with 43 additions and 85 deletions
|
@ -314,7 +314,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid
|
|||
if (bpt == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
bpt = bpt.adjustToWorld(worldObj, x, y, z, o);
|
||||
|
||||
if (getStackInSlot(0).getItem() instanceof ItemBlueprintStandard) {
|
||||
|
|
|
@ -19,17 +19,8 @@ import buildcraft.core.proxy.CoreProxy;
|
|||
|
||||
public class TickHandlerCore {
|
||||
|
||||
public static Integer startSynchronousComputation = new Integer(0);
|
||||
|
||||
private boolean nagged;
|
||||
|
||||
@SubscribeEvent
|
||||
public void synchronizationControl(ServerTickEvent evt) {
|
||||
synchronized (startSynchronousComputation) {
|
||||
startSynchronousComputation.notify();
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void checkUpToDate(PlayerTickEvent evt) {
|
||||
|
|
11
common/buildcraft/core/robots/boards/BoardRobotFarmer.java
Executable file → Normal file
11
common/buildcraft/core/robots/boards/BoardRobotFarmer.java
Executable file → Normal file
|
@ -124,15 +124,8 @@ public class BoardRobotFarmer extends RedstoneBoardRobot {
|
|||
}
|
||||
|
||||
private boolean isAirAbove(World world, int x, int y, int z) {
|
||||
synchronized (TickHandlerCore.startSynchronousComputation) {
|
||||
try {
|
||||
TickHandlerCore.startSynchronousComputation.wait();
|
||||
|
||||
return world.isAirBlock(x, y + 1, z);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
synchronized (world) {
|
||||
return world.isAirBlock(x, y + 1, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
31
common/buildcraft/core/robots/boards/BoardRobotGenericBreakBlock.java
Executable file → Normal file
31
common/buildcraft/core/robots/boards/BoardRobotGenericBreakBlock.java
Executable file → Normal file
|
@ -148,25 +148,20 @@ public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
|
|||
return true;
|
||||
}
|
||||
|
||||
synchronized (TickHandlerCore.startSynchronousComputation) {
|
||||
try {
|
||||
TickHandlerCore.startSynchronousComputation.wait();
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
for (int i = 0; i < blockFilter.size(); ++i) {
|
||||
if (blockFilter.get(i) == block && metaFilter.get(i) == meta) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
Block block;
|
||||
int meta;
|
||||
synchronized (world) {
|
||||
block = world.getBlock(x, y, z);
|
||||
meta = world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
for (int i = 0; i < blockFilter.size(); ++i) {
|
||||
if (blockFilter.get(i) == block && metaFilter.get(i) == meta) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
11
common/buildcraft/core/robots/boards/BoardRobotPlanter.java
Executable file → Normal file
11
common/buildcraft/core/robots/boards/BoardRobotPlanter.java
Executable file → Normal file
|
@ -146,15 +146,8 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
|
|||
}
|
||||
|
||||
private boolean isAirAbove(World world, int x, int y, int z) {
|
||||
synchronized (TickHandlerCore.startSynchronousComputation) {
|
||||
try {
|
||||
TickHandlerCore.startSynchronousComputation.wait();
|
||||
|
||||
return world.isAirBlock(x, y + 1, z);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
synchronized (world) {
|
||||
return world.isAirBlock(x, y + 1, z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
31
common/buildcraft/core/robots/boards/BoardRobotPump.java
Executable file → Normal file
31
common/buildcraft/core/robots/boards/BoardRobotPump.java
Executable file → Normal file
|
@ -137,25 +137,20 @@ public class BoardRobotPump extends RedstoneBoardRobot {
|
|||
return true;
|
||||
}
|
||||
|
||||
synchronized (TickHandlerCore.startSynchronousComputation) {
|
||||
try {
|
||||
TickHandlerCore.startSynchronousComputation.wait();
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
for (Fluid f : fluidFilter) {
|
||||
if (f.getID() == fluid.getID()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
Block block;
|
||||
synchronized (world) {
|
||||
block = world.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
|
||||
|
||||
for (Fluid f : fluidFilter) {
|
||||
if (f.getID() == fluid.getID()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
33
common/buildcraft/core/utils/DimensionProperty.java
Executable file → Normal file
33
common/buildcraft/core/utils/DimensionProperty.java
Executable file → Normal file
|
@ -53,28 +53,19 @@ public class DimensionProperty implements IWorldAccess {
|
|||
}
|
||||
|
||||
private void load(Chunk chunk, ChunkProperty property) {
|
||||
synchronized (TickHandlerCore.startSynchronousComputation) {
|
||||
try {
|
||||
if (Thread.currentThread() != BuildCraftCore.instance.serverThread) {
|
||||
TickHandlerCore.startSynchronousComputation.wait();
|
||||
}
|
||||
synchronized (world) {
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
for (int y = 0; y < worldHeight; ++y) {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
Block block = chunk.getBlock(x, y, z);
|
||||
int meta = chunk.getBlockMetadata(x, y, z);
|
||||
|
||||
for (int x = 0; x < 16; ++x) {
|
||||
for (int y = 0; y < worldHeight; ++y) {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
Block block = chunk.getBlock(x, y, z);
|
||||
int meta = chunk.getBlockMetadata(x, y, z);
|
||||
|
||||
boolean prop = worldProperty.
|
||||
get(world, block, meta, chunk.xPosition * 16 + x, y, chunk.zPosition * 16 + z);
|
||||
property.set(x, y, z, prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
boolean prop = worldProperty.
|
||||
get(world, block, meta, chunk.xPosition * 16 + x, y, chunk.zPosition * 16 + z);
|
||||
property.set(x, y, z, prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue