mirror of
https://github.com/BentoBoxWorld/CaveBlock.git
synced 2024-11-22 11:35:11 +01:00
Fix issue when populator tries to place block outside world bounds.
This commit is contained in:
commit
a14f076c65
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>caveblock</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<version>0.0.2</version>
|
||||
|
||||
<name>CaveBlock</name>
|
||||
<description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
|
||||
@ -223,4 +223,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
@ -64,7 +64,7 @@ public class EntitiesPopulator extends BlockPopulator
|
||||
|
||||
for (Map.Entry<EntityType, Pair<Integer, Integer>> entry : entityChanceMap.entrySet())
|
||||
{
|
||||
for (int subY = 1; subY < worldHeight; subY += 16)
|
||||
for (int subY = 0; subY < worldHeight; subY += 16)
|
||||
{
|
||||
for (int tries = 0; tries < generationTry; tries++)
|
||||
{
|
||||
@ -72,7 +72,7 @@ public class EntitiesPopulator extends BlockPopulator
|
||||
{
|
||||
int x = random.nextInt(15);
|
||||
int z = random.nextInt(15);
|
||||
int y = subY + random.nextInt(15);
|
||||
int y = Math.min(worldHeight - 2, subY + random.nextInt(15));
|
||||
|
||||
this.tryToPlaceEntity(world, chunk.getBlock(x, y, z), entry.getKey(), x, z, mainMaterial);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class MaterialPopulator extends BlockPopulator
|
||||
|
||||
for (Map.Entry<Material, Pair<Integer, Integer>> entry : materialChanceMap.entrySet())
|
||||
{
|
||||
for (int subY = 1; subY < worldHeight; subY += 16)
|
||||
for (int subY = 0; subY < worldHeight; subY += 16)
|
||||
{
|
||||
for (int tries = 0; tries < generationTry; tries++)
|
||||
{
|
||||
@ -74,7 +74,7 @@ public class MaterialPopulator extends BlockPopulator
|
||||
{
|
||||
int x = random.nextInt(15);
|
||||
int z = random.nextInt(15);
|
||||
int y = subY + random.nextInt(16);
|
||||
int y = Math.min(worldHeight - 2, subY + random.nextInt(15));
|
||||
|
||||
Block block = chunk.getBlock(x, y, z);
|
||||
|
||||
@ -100,7 +100,7 @@ public class MaterialPopulator extends BlockPopulator
|
||||
x = Math.min(15, x + 1);
|
||||
break;
|
||||
case 1:
|
||||
y = Math.min(worldHeight - 1, y + 1);
|
||||
y = Math.min(worldHeight - 2, y + 1);
|
||||
break;
|
||||
case 2:
|
||||
z = Math.min(15, z + 1);
|
||||
@ -109,7 +109,7 @@ public class MaterialPopulator extends BlockPopulator
|
||||
x = Math.max(0, x - 1);
|
||||
break;
|
||||
case 4:
|
||||
y = Math.max(0, y - 1);
|
||||
y = Math.max(1, y - 1);
|
||||
break;
|
||||
case 5:
|
||||
z = Math.max(0, z - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user