From 22bd2f0628101e50dc03b0b51fca905b18fb4748 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Mon, 14 Mar 2016 20:16:31 -0400 Subject: [PATCH] Fixed WillChunks so that you should not get a null chunk when requested. --- changelog.txt | 1 + .../demonAura/WorldDemonWillHandler.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 922eef34..38833b8f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Version 2.0.0-20 ------------------------------------------------------ - Fixed Blood Altar crashing on odd occasions. - Fixed GUI of hellfire forge. +- Fixed issue with Will Chunks not generating when requested in new chunks ------------------------------------------------------ Version 2.0.0-19 diff --git a/src/main/java/WayofTime/bloodmagic/demonAura/WorldDemonWillHandler.java b/src/main/java/WayofTime/bloodmagic/demonAura/WorldDemonWillHandler.java index 8072fd9c..8a7afc33 100644 --- a/src/main/java/WayofTime/bloodmagic/demonAura/WorldDemonWillHandler.java +++ b/src/main/java/WayofTime/bloodmagic/demonAura/WorldDemonWillHandler.java @@ -23,12 +23,12 @@ public class WorldDemonWillHandler public static WillChunk getWillChunk(int dim, int x, int y) { - if (containedWills.containsKey(dim)) + if (!containedWills.containsKey(dim)) { - return (containedWills.get(dim)).getWillChunkAt(x, y); + addWillWorld(dim); } - return null; + return (containedWills.get(dim)).getWillChunkAt(x, y); } public static void addWillWorld(int dim) @@ -143,7 +143,16 @@ public class WorldDemonWillHandler public static WillChunk getWillChunk(World world, BlockPos pos) { - return getWillChunk(world.provider.getDimensionId(), pos.getX() >> 4, pos.getZ() >> 4); + WillChunk willChunk = getWillChunk(world.provider.getDimensionId(), pos.getX() >> 4, pos.getZ() >> 4); + if (willChunk == null) + { + Chunk chunk = world.getChunkFromBlockCoords(pos); + generateWill(chunk); + + willChunk = getWillChunk(world.provider.getDimensionId(), pos.getX() >> 4, pos.getZ() >> 4); + } + + return willChunk; } public static double getCurrentWill(World world, BlockPos pos, EnumDemonWillType type)