Fixed the Force Relay not properly saving to the world's data if not pushed by a piston. Closes #835

This commit is contained in:
Lizbeth Rika committed 2015-04-30 14:30:19 +01:00
1 parent 59eab2a920
commit 4ac408dc3e
2 files changed
+13 -4

No files matched your search

@@ -144,6 +144,11 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
public void onWorldLoad(WorldEvent.Load event) {
WorldData.get(event.world);
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
WorldData.get(event.world).markDirty();
}
public static class WorldData extends WorldSavedData {
@@ -245,9 +250,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
pos = mappedPositions.get(s);
mappedPositions.remove(s);
mappedPositions.put(newPos, pos);
WorldData data = WorldData.get(world);
if(data != null)
data.markDirty();
save(world);
}
}
}
@@ -263,6 +266,12 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
removeThese.clear();
}
public void save(World world) {
WorldData data = WorldData.get(world);
if(data != null)
data.markDirty();
}
@Override
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.pistonRelay;
@@ -153,7 +153,7 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
}
return wanded;
} else if(BlockPistonRelay.playerPositions.containsKey(par2EntityPlayer.getCommandSenderName())) {
} else if(BlockPistonRelay.playerPositions.containsKey(par2EntityPlayer.getCommandSenderName()) && !par3World.isRemote) {
String bindPos = BlockPistonRelay.playerPositions.get(par2EntityPlayer.getCommandSenderName());
String currentPos = BlockPistonRelay.getCoordsAsString(par3World.provider.dimensionId, par4, par5, par6);