Fix up Hive Generation

This commit is contained in:
mezz committed 2016-05-06 22:03:26 -07:00
1 parent 6d00d35ae5
commit fed1994838
16 files changed
+146 -131

No files matched your search

@@ -5,7 +5,7 @@
******************************************************************************/
package forestry.api.apiculture.hives;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -23,9 +23,7 @@ public interface IHiveDescription {
/**
* The hive block to be placed in the world.
*/
Block getBlock();
int getMeta();
IBlockState getBlockState();
/**
* returns true if the hive can be generated in these conditions.
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.apiculture.hives;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -12,10 +14,11 @@ import net.minecraft.world.World;
public interface IHiveGen {
/**
* return a Y value that the hive should try to generate at.
* returns negative if the hive can't be placed anywhere.
* return a position that the hive should try to generate at.
* returns null if the hive can't be placed anywhere.
*/
int getYForHive(World world, int x, int z);
@Nullable
BlockPos getPosForHive(World world, int x, int z);
/**
* returns true if the hive can be generated at this location.
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.blocks;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -70,6 +71,10 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister,
return getDefaultState().withProperty(HIVE_TYPES, HiveType.VALUES[meta]);
}
public IBlockState getStateForType(@Nonnull HiveType type) {
return getDefaultState().withProperty(HIVE_TYPES, type);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileHive();
@@ -156,7 +156,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
BlockPos minPos = beeHousing.getCoordinates().add(-area.getX() / 2, -area.getY() / 2, -area.getZ() / 2);
BlockPos maxPos = minPos.add(area);
for (BlockPos posBlock : BlockPos.getAllInBox(minPos, maxPos)) {
for (BlockPos posBlock : BlockPos.getAllInBoxMutable(minPos, maxPos)) {
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
if (acceptableRule.isAcceptableFlower(flowerType, world, posBlock)) {
return posBlock;
@@ -135,10 +135,10 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(toSpawn);
Hive hive = new Hive(hiveDescription);
int chunkX = (getPos().getX() + worldObj.rand.nextInt(40 * 2) - 40) / 16;
int chunkZ = (getPos().getZ() + worldObj.rand.nextInt(40 * 2) - 40) / 16;
int x = getPos().getX() + worldObj.rand.nextInt(40 * 2) - 40;
int z = getPos().getZ() + worldObj.rand.nextInt(40 * 2) - 40;
if (HiveDecorator.genHive(worldObj, worldObj.rand, chunkX, chunkZ, hive)) {
if (HiveDecorator.tryGenHive(worldObj, x, z, hive)) {
pendingSpawns.pop();
}
}
@@ -53,6 +53,7 @@ import forestry.apiculture.blocks.BlockBeeHives;
import forestry.apiculture.genetics.BeeDefinition;
import forestry.apiculture.genetics.alleles.AlleleEffect;
import forestry.apiculture.network.packets.PacketActiveUpdate;
import forestry.core.config.Config;
import forestry.core.inventory.InventoryAdapter;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.IActivatable;
@@ -90,6 +91,10 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
@Override
public void update() {
if (Config.generateBeehivesDebug) {
return;
}
if (worldObj.isRemote) {
if (!updatedLight && worldObj.getWorldTime() % 20 == 0) {
updatedLight = worldObj.checkLightFor(EnumSkyBlock.BLOCK, getPos());
@@ -10,10 +10,11 @@
******************************************************************************/
package forestry.apiculture.worldgen;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -36,12 +37,8 @@ public final class Hive {
this.hiveDescription = hiveDescription;
}
public Block getHiveBlock() {
return hiveDescription.getBlock();
}
public int getHiveMeta() {
return hiveDescription.getMeta();
public IBlockState getHiveBlockState() {
return hiveDescription.getBlockState();
}
public void addDrops(List<IHiveDrop> drops) {
@@ -81,7 +78,13 @@ public final class Hive {
return hiveDescription.getHiveGen().canReplace(blockState, world, pos);
}
public int getYForHive(World world, int x, int z) {
return hiveDescription.getHiveGen().getYForHive(world, x, z);
@Nullable
public BlockPos getPosForHive(World world, int x, int z) {
return hiveDescription.getHiveGen().getPosForHive(world, x, z);
}
@Override
public String toString() {
return hiveDescription + " hive";
}
}
@@ -29,6 +29,7 @@ import forestry.api.core.EnumTemperature;
import forestry.apiculture.PluginApiculture;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.utils.Log;
public abstract class HiveDecorator {
@@ -50,44 +51,38 @@ public abstract class HiveDecorator {
return;
}
int worldX = (chunkX << 4) + 8;
int worldZ = (chunkZ << 4) + 8;
Collections.shuffle(hives, rand);
for (Hive hive : hives) {
if (genHive(world, rand, chunkX, chunkZ, hive)) {
return;
}
}
}
public static boolean genHive(World world, Random rand, int chunkX, int chunkZ, Hive hive) {
if (hive.genChance() * Config.getBeehivesAmount() < rand.nextFloat() * 100.0f) {
return false;
}
int worldX = chunkX * 16;
int worldZ = chunkZ * 16;
BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(worldX, 0, worldZ));
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall());
if (!hive.isGoodBiome(biome) || !hive.isGoodHumidity(humidity)) {
return false;
}
for (int tries = 0; tries < 4; tries++) {
int x = worldX + rand.nextInt(16);
int z = worldZ + rand.nextInt(16);
if (tryGenHive(world, x, z, hive)) {
return true;
BlockPos pos = new BlockPos(x, 0, z);
if (!world.isBlockLoaded(pos)) {
Log.error("tried to generated a hive in an unloaded area.");
return;
}
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall());
for (Hive hive : hives) {
if (hive.genChance() * Config.getBeehivesAmount() >= rand.nextFloat() * 100.0f) {
if (hive.isGoodBiome(biome) && hive.isGoodHumidity(humidity)) {
if (tryGenHive(world, x, z, hive)) {
return;
}
}
}
}
}
return false;
}
private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> hives) {
int worldX = chunkX * 16;
int worldZ = chunkZ * 16;
int worldX = (chunkX << 4) + 8;
int worldZ = (chunkZ << 4) + 8;
BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(chunkX, 0, chunkZ));
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall());
@@ -105,34 +100,35 @@ public abstract class HiveDecorator {
}
}
private static boolean tryGenHive(World world, int x, int z, Hive hive) {
public static boolean tryGenHive(World world, int x, int z, Hive hive) {
int y = hive.getYForHive(world, x, z);
final BlockPos hivePos = hive.getPosForHive(world, x, z);
if (y < 0) {
if (hivePos == null) {
return false;
}
if (!hive.canReplace(world, new BlockPos(x, y, z))) {
if (!hive.canReplace(world, hivePos)) {
return false;
}
BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(x, 0, z));
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getFloatTemperature(new BlockPos(x, 0, z)));
BiomeGenBase biome = world.getBiomeGenForCoords(hivePos);
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getFloatTemperature(hivePos));
if (!hive.isGoodTemperature(temperature)) {
return false;
}
if (!hive.isValidLocation(world, new BlockPos(x, y, z))) {
if (!hive.isValidLocation(world, hivePos)) {
return false;
}
return setHive(world, new BlockPos(x, y, z), hive);
return setHive(world, hivePos, hive);
}
private static boolean setHive(World world, BlockPos pos, Hive hive) {
Block hiveBlock = hive.getHiveBlock();
boolean placed = world.setBlockState(pos, hiveBlock.getStateFromMeta(hive.getHiveMeta()), Constants.FLAG_BLOCK_SYNCH);
IBlockState hiveState = hive.getHiveBlockState();
Block hiveBlock = hiveState.getBlock();
boolean placed = world.setBlockState(pos, hiveState, Constants.FLAG_BLOCK_SYNCH);
if (!placed) {
return false;
}
@@ -148,6 +144,11 @@ public abstract class HiveDecorator {
if (!Config.generateBeehivesDebug) {
hive.postGen(world, pos);
}
if (Config.logHivePlacement) {
Log.info("Placed {} at {}", hive, pos);
}
return true;
}
}
@@ -29,6 +29,7 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.hives.HiveManager;
import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen;
import forestry.api.apiculture.hives.IHiveRegistry;
import forestry.api.core.BiomeHelper;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -39,35 +40,35 @@ import forestry.apiculture.genetics.BeeDefinition;
public enum HiveDescription implements IHiveDescription {
FOREST(0, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()) {
FOREST(IHiveRegistry.HiveType.FOREST, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
}
},
MEADOWS(1, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
MEADOWS(IHiveRegistry.HiveType.MEADOWS, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
}
},
DESERT(2, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) {
DESERT(IHiveRegistry.HiveType.DESERT, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, cactusStates);
}
},
JUNGLE(3, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
END(4, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
END(IHiveRegistry.HiveType.END, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
@Override
public boolean isGoodBiome(BiomeGenBase biome) {
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
}
},
SNOW(5, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) {
SNOW(IHiveRegistry.HiveType.SNOW, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) {
@Override
public void postGen(World world, BlockPos pos) {
if (world.isAirBlock(pos.add(0, 1, 0))) {
@@ -77,7 +78,7 @@ public enum HiveDescription implements IHiveDescription {
postGenFlowers(world, pos, flowerStates);
}
},
SWAMP(6, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
SWAMP(IHiveRegistry.HiveType.SWAMP, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
@@ -98,13 +99,13 @@ public enum HiveDescription implements IHiveDescription {
mushroomStates.add(Blocks.BROWN_MUSHROOM.getDefaultState());
}
private final int meta;
private final IBlockState blockState;
private final float genChance;
private final IBeeGenome beeGenome;
private final IHiveGen hiveGen;
HiveDescription(int meta, float genChance, BeeDefinition beeTemplate, IHiveGen hiveGen) {
this.meta = meta;
HiveDescription(IHiveRegistry.HiveType hiveType, float genChance, BeeDefinition beeTemplate, IHiveGen hiveGen) {
this.blockState = PluginApiculture.blocks.beehives.getStateForType(hiveType);
this.genChance = genChance;
this.beeGenome = beeTemplate.getGenome();
this.hiveGen = hiveGen;
@@ -116,13 +117,8 @@ public enum HiveDescription implements IHiveDescription {
}
@Override
public Block getBlock() {
return PluginApiculture.blocks.beehives;
}
@Override
public int getMeta() {
return meta;
public IBlockState getBlockState() {
return blockState;
}
@Override
@@ -160,16 +156,15 @@ public enum HiveDescription implements IHiveDescription {
int xOffset = world.rand.nextInt(8) - 4;
int zOffset = world.rand.nextInt(8) - 4;
BlockPos blockPos = hivePos.add(xOffset, 0, zOffset);
if (!world.isBlockLoaded(blockPos) || xOffset == 0 && zOffset == 0) {
if ((xOffset == 0 && zOffset == 0) || !world.isBlockLoaded(blockPos)) {
continue;
}
int y = groundGen.getYForHive(world, blockPos.getX(), blockPos.getZ());
if (y <= 0) {
blockPos = groundGen.getPosForHive(world, blockPos.getX(), blockPos.getZ());
if (blockPos == null) {
continue;
}
blockPos = new BlockPos(blockPos.getX(), y, blockPos.getZ());
IBlockState state = flowerStates.get(world.rand.nextInt(flowerStates.size()));
Block block = state.getBlock();
if (!block.canPlaceBlockAt(world, blockPos)) {
@@ -179,18 +174,6 @@ public enum HiveDescription implements IHiveDescription {
world.setBlockState(blockPos, state);
plantedCount++;
if (block instanceof IPlantable) {
IPlantable plantable = (IPlantable) block;
BlockPos groundPos = blockPos.down();
IBlockState blockState = world.getBlockState(groundPos);
Block ground = blockState.getBlock();
if (!ground.canSustainPlant(blockState, world, groundPos, EnumFacing.UP, plantable)) {
world.setBlockToAir(blockPos);
plantedCount--;
}
}
if (plantedCount >= 3) {
break;
}
@@ -13,7 +13,7 @@ package forestry.apiculture.worldgen;
import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -23,6 +23,7 @@ import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen;
import forestry.api.apiculture.hives.IHiveRegistry;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.apiculture.PluginApiculture;
@@ -42,13 +43,8 @@ public class HiveDescriptionSwarmer implements IHiveDescription {
}
@Override
public Block getBlock() {
return PluginApiculture.blocks.beehives;
}
@Override
public int getMeta() {
return 7;
public IBlockState getBlockState() {
return PluginApiculture.blocks.beehives.getStateForType(IHiveRegistry.HiveType.SWARM);
}
@Override
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.worldgen;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -19,6 +20,11 @@ import forestry.core.utils.BlockUtil;
public abstract class HiveGen implements IHiveGen {
public static boolean isTreeBlock(IBlockState blockState, World world, BlockPos pos) {
Block block = blockState.getBlock();
return block.isLeaves(blockState, world, pos) || block.isWood(world, pos);
}
@Override
public boolean canReplace(IBlockState blockState, World world, BlockPos pos) {
return BlockUtil.canReplace(blockState, world, pos);
@@ -16,6 +16,7 @@ import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -40,18 +41,24 @@ public class HiveGenGround extends HiveGen {
}
@Override
public int getYForHive(World world, int x, int z) {
public BlockPos getPosForHive(World world, int x, int z) {
// get to the ground
BlockPos pos = world.getHeight(new BlockPos(x, 0, z));
IBlockState blockState = world.getBlockState(pos.down());
Block block = blockState.getBlock();
while (pos.getY() >= 0 && (block.isLeaves(blockState, world, pos.down()) || canReplace(blockState, world, pos.down()))) {
pos = pos.down();
blockState = world.getBlockState(pos);
block = blockState.getBlock();
final BlockPos topPos = world.getHeight(new BlockPos(x, 0, z));
if (topPos.getY() == 0) {
return null;
}
return pos.getY();
final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(topPos);
IBlockState blockState = world.getBlockState(pos);
while (isTreeBlock(blockState, world, pos) || canReplace(blockState, world, pos)) {
pos.offsetMutable(EnumFacing.DOWN);
if (pos.getY() <= 0) {
return null;
}
blockState = world.getBlockState(pos);
}
return pos.up();
}
}
@@ -12,6 +12,7 @@ package forestry.apiculture.worldgen;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -19,32 +20,39 @@ public class HiveGenTree extends HiveGen {
@Override
public boolean isValidLocation(World world, BlockPos pos) {
IBlockState blockState = world.getBlockState(pos.up());
Block blockAbove = blockState.getBlock();
if (!blockAbove.isLeaves(blockState, world, pos.up())) {
BlockPos posAbove = pos.up();
IBlockState blockStateAbove = world.getBlockState(posAbove);
if (!isTreeBlock(blockStateAbove, world, posAbove)) {
return false;
}
// not a good location if right on top of something
return canReplace(blockState, world, pos.down());
BlockPos posBelow = pos.down();
IBlockState blockStateBelow = world.getBlockState(posBelow);
return canReplace(blockStateBelow, world, posBelow);
}
@Override
public int getYForHive(World world, int x, int z) {
public BlockPos getPosForHive(World world, int x, int z) {
// get top leaf block
int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1;
BlockPos pos = new BlockPos(x, y, z);
IBlockState blockState = world.getBlockState(pos);
if (!blockState.getBlock().isLeaves(blockState, world, pos)) {
return -1;
final BlockPos topPos = world.getHeight(new BlockPos(x, 0, z)).down();
if (topPos.getY() <= 0) {
return null;
}
IBlockState blockState = world.getBlockState(topPos);
if (!isTreeBlock(blockState, world, topPos)) {
return null;
}
// get to the bottom of the leaves
final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(topPos);
do {
pos = pos.down();
pos.offsetMutable(EnumFacing.DOWN);
blockState = world.getBlockState(pos);
} while (blockState.getBlock().isLeaves(blockState, world, pos));
} while (isTreeBlock(blockState, world, pos));
return y;
return pos.toImmutable();
}
}
@@ -68,6 +68,7 @@ public class Config {
public static boolean generateTinOre = true;
private static float generateBeehivesAmount = 1.5f;
public static boolean generateBeehivesDebug = false;
public static boolean logHivePlacement = true;
public static boolean enableVillagers = true;
// Retrogen
@@ -274,8 +274,7 @@ public abstract class BlockUtil {
public static boolean canReplace(IBlockState blockState, World world, BlockPos pos) {
Block block = blockState.getBlock();
Material material = block.getMaterial(blockState);
return material.isReplaceable() && block.isReplaceable(world, pos) && !material.isLiquid() || block.isAir(blockState, world, pos) || material == Material.PLANTS;
return block.isReplaceable(world, pos) && !block.getMaterial(blockState).isLiquid();
}
public static boolean canPlaceTree(IBlockState blockState, World world, BlockPos pos){
@@ -71,15 +71,15 @@ public class WorldGenerator implements IWorldGenerator {
}
// shift to world coordinates
chunkX = chunkX << 4;
chunkZ = chunkZ << 4;
int x = chunkX << 4;
int y = chunkZ << 4;
// / APATITE
if (Config.generateApatiteOre) {
if (random.nextFloat() < 0.8f) {
int randPosX = chunkX + random.nextInt(16);
int randPosX = x + random.nextInt(16);
int randPosY = random.nextInt(world.getActualHeight() - 72) + 56; // Does not generate below y = 64
int randPosZ = chunkZ + random.nextInt(16);
int randPosZ = y + random.nextInt(16);
apatiteGenerator.generate(world, random, new BlockPos(randPosX, randPosY, randPosZ));
}
}
@@ -87,9 +87,9 @@ public class WorldGenerator implements IWorldGenerator {
// / COPPER
if (Config.generateCopperOre) {
for (int i = 0; i < 20; i++) {
int randPosX = chunkX + random.nextInt(16);
int randPosX = x + random.nextInt(16);
int randPosY = random.nextInt(76) + 32;
int randPosZ = chunkZ + random.nextInt(16);
int randPosZ = y + random.nextInt(16);
copperGenerator.generate(world, random, new BlockPos(randPosX, randPosY, randPosZ));
}
}
@@ -97,9 +97,9 @@ public class WorldGenerator implements IWorldGenerator {
// / TIN
if (Config.generateTinOre) {
for (int i = 0; i < 18; i++) {
int randPosX = chunkX + random.nextInt(16);
int randPosX = x + random.nextInt(16);
int randPosY = random.nextInt(76) + 16;
int randPosZ = chunkZ + random.nextInt(16);
int randPosZ = y + random.nextInt(16);
tinGenerator.generate(world, random, new BlockPos(randPosX, randPosY, randPosZ));
}
}