fixed deadlock when getting properties from main thread

This commit is contained in:
SpaceToad 2014-09-14 15:43:09 +02:00
parent b906f7b7a8
commit 4e843c5104
2 changed files with 7 additions and 1 deletions

View file

@ -264,6 +264,8 @@ public class BuildCraftCore extends BuildCraftMod {
private static FloatBuffer pos = ByteBuffer.allocateDirect(3 * 4).asFloatBuffer();
public Thread serverThread;
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Core");
@ -435,6 +437,7 @@ public class BuildCraftCore extends BuildCraftMod {
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) {
serverThread = Thread.currentThread();
event.registerServerCommand(new CommandBuildCraft());
}

View file

@ -17,6 +17,7 @@ import net.minecraft.world.IWorldAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import buildcraft.BuildCraftCore;
import buildcraft.core.TickHandlerCore;
public class DimensionProperty implements IWorldAccess {
@ -54,7 +55,9 @@ public class DimensionProperty implements IWorldAccess {
private void load(Chunk chunk, ChunkProperty property) {
synchronized (TickHandlerCore.startSynchronousComputation) {
try {
TickHandlerCore.startSynchronousComputation.wait();
if (Thread.currentThread() != BuildCraftCore.instance.serverThread) {
TickHandlerCore.startSynchronousComputation.wait();
}
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < worldHeight; ++y) {