Fixed WillChunks so that you should not get a null chunk when requested.

This commit is contained in:
WayofTime 2016-03-14 20:16:31 -04:00
parent 698358df23
commit 22bd2f0628
2 changed files with 14 additions and 4 deletions

View file

@ -3,6 +3,7 @@ Version 2.0.0-20
------------------------------------------------------ ------------------------------------------------------
- Fixed Blood Altar crashing on odd occasions. - Fixed Blood Altar crashing on odd occasions.
- Fixed GUI of hellfire forge. - Fixed GUI of hellfire forge.
- Fixed issue with Will Chunks not generating when requested in new chunks
------------------------------------------------------ ------------------------------------------------------
Version 2.0.0-19 Version 2.0.0-19

View file

@ -23,12 +23,12 @@ public class WorldDemonWillHandler
public static WillChunk getWillChunk(int dim, int x, int y) 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) public static void addWillWorld(int dim)
@ -143,7 +143,16 @@ public class WorldDemonWillHandler
public static WillChunk getWillChunk(World world, BlockPos pos) 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) public static double getCurrentWill(World world, BlockPos pos, EnumDemonWillType type)