use of net.minecraft.util.math.BlockPos in project NetherEx by LogicTechCorp.
the class WorldGenThornstalk method generate.
public boolean generate(World world, Random rand, BlockPos pos) {
for (int i = 0; i < 64; ++i) {
BlockPos newPos = pos.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
Block blockDown = world.getBlockState(newPos.down()).getBlock();
if (blockDown == Blocks.SOUL_SAND && NetherExBlocks.PLANT_THORNSTALK.canPlaceBlockAt(world, newPos)) {
NetherExBlocks.PLANT_THORNSTALK.generate(world, rand, newPos);
}
}
return true;
}
use of net.minecraft.util.math.BlockPos in project NetherEx by LogicTechCorp.
the class WorldGenCeilingStructure method generate.
@Override
public boolean generate(World world, Random rand, BlockPos pos) {
rand = world.getChunkFromBlockCoords(pos).getRandomWithSeed(world.getSeed());
Mirror[] mirrors = Mirror.values();
Rotation[] rotations = Rotation.values();
Mirror mirror = mirrors[rand.nextInt(mirrors.length)];
Rotation rotation = rotations[rand.nextInt(rotations.length)];
MinecraftServer server = world.getMinecraftServer();
TemplateManager manager = world.getSaveHandler().getStructureTemplateManager();
Template template = manager.getTemplate(server, WeightedUtil.getRandomStructure(rand, variants));
PlacementSettings placementSettings = new PlacementSettings().setMirror(mirror).setRotation(rotation).setReplacedBlock(Blocks.STRUCTURE_VOID).setRandom(rand);
BlockPos structureSize = Template.transformedBlockPos(placementSettings, template.getSize());
BlockPos newPos = new BlockPos(pos.getX() - structureSize.getX() / 2, 48, pos.getZ() - structureSize.getZ() / 2);
BlockPos spawnPos = WorldGenUtil.getSuitableCeilingPos(world, newPos, structureSize);
if (!spawnPos.equals(BlockPos.ORIGIN)) {
WorldGenUtil.generateStructure(world, spawnPos, rand, template, placementSettings, lootTables, spawnerMobs);
return true;
}
return false;
}
use of net.minecraft.util.math.BlockPos in project NetherEx by LogicTechCorp.
the class PigtificateVillageCollection method addFenceGatesAround.
private void addFenceGatesAround(BlockPos central) {
for (int l = -16; l < 16; ++l) {
for (int i1 = -4; i1 < 4; ++i1) {
for (int j1 = -16; j1 < 16; ++j1) {
BlockPos blockpos = central.add(l, i1, j1);
EnumFacing outside = getOutside(blockpos);
if (outside != null) {
VillageFenceGateInfo villagefenceGateinfo = checkFenceGateExistence(blockpos);
if (villagefenceGateinfo == null) {
addToNewFenceGatesList(blockpos, outside);
} else {
villagefenceGateinfo.setLastActivityTimestamp(tickCounter);
}
}
}
}
}
}
use of net.minecraft.util.math.BlockPos in project NetherEx by LogicTechCorp.
the class ChunkProviderNether method populate.
@Override
public void populate(int chunkX, int chunkZ) {
boolean logCascadingWorldGeneration = ForgeModContainer.logCascadingWorldGeneration;
ForgeModContainer.logCascadingWorldGeneration = false;
ChunkPos chunkPos = new ChunkPos(chunkX, chunkZ);
BlockPos blockPos = new BlockPos(chunkX * 16, 0, chunkZ * 16);
Biome biome = world.getBiomeForCoordsBody(blockPos.add(16, 0, 16));
BlockFalling.fallInstantly = true;
netherBridge.generateStructure(world, rand, chunkPos);
biome.decorate(world, rand, blockPos);
BlockFalling.fallInstantly = false;
ForgeModContainer.logCascadingWorldGeneration = logCascadingWorldGeneration;
}
use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class DimensionInformation method writeToNBT.
public void writeToNBT(NBTTagCompound tagCompound) {
tagCompound.setString("name", getName());
tagCompound.setString("owner", ownerName);
if (owner != null) {
tagCompound.setLong("ownerM", owner.getMostSignificantBits());
tagCompound.setLong("ownerL", owner.getLeastSignificantBits());
}
BlockPos spawnPoint = getSpawnPoint();
if (spawnPoint != null) {
BlockPosTools.writeToNBT(tagCompound, "spawnPoint", spawnPoint);
}
tagCompound.setInteger("probeCounter", getProbeCounter());
// Version number so that we can detect incompatible changes in persisted dimension information objects.
tagCompound.setInteger("version", 1);
tagCompound.setInteger("terrain", terrainType == null ? TerrainType.TERRAIN_VOID.ordinal() : terrainType.ordinal());
tagCompound.setIntArray("features", toIntArray(featureTypes));
tagCompound.setIntArray("structures", toIntArray(structureTypes));
tagCompound.setIntArray("effects", toIntArray(effectTypes));
List<Integer> c = new ArrayList<Integer>(biomes.size());
for (Biome t : biomes) {
if (t != null) {
c.add(Biome.getIdForBiome(t));
} else {
c.add(Biome.getIdForBiome(Biomes.PLAINS));
}
}
tagCompound.setIntArray("biomes", ArrayUtils.toPrimitive(c.toArray(new Integer[c.size()])));
tagCompound.setInteger("controller", controllerType == null ? ControllerType.CONTROLLER_DEFAULT.ordinal() : controllerType.ordinal());
tagCompound.setString("digits", digitString);
tagCompound.setLong("forcedSeed", forcedDimensionSeed);
tagCompound.setLong("baseSeed", baseSeed);
tagCompound.setInteger("worldVersion", worldVersion);
setBlockMeta(tagCompound, baseBlockForTerrain, "baseBlock");
setBlockMeta(tagCompound, tendrilBlock, "tendrilBlock");
writeBlocksToNBT(tagCompound, pyramidBlocks, "pyramidBlocks");
writeBlocksToNBT(tagCompound, sphereBlocks, "sphereBlocks");
if (sphereBlocks.length > 0) {
// Write out a single sphere block for compatibility with older RFTools.
setBlockMeta(tagCompound, sphereBlocks[0], "sphereBlock");
}
writeBlocksToNBT(tagCompound, hugeSphereBlocks, "hugeSphereBlocks");
writeBlocksToNBT(tagCompound, scatteredSphereBlocks, "scatteredSphereBlocks");
writeBlocksToNBT(tagCompound, hugeLiquidSphereBlocks, "hugeLiquidSphereBlocks");
writeFluidsToNBT(tagCompound, hugeLiquidSphereFluids, "hugeLiquidSphereFluids");
writeBlocksToNBT(tagCompound, liquidSphereBlocks, "liquidSphereBlocks");
if (liquidSphereBlocks.length > 0) {
// Write out a single sphere block for compatibility with older RFTools.
setBlockMeta(tagCompound, liquidSphereBlocks[0], "liquidSphereBlock");
}
writeFluidsToNBT(tagCompound, liquidSphereFluids, "liquidSphereFluids");
if (liquidSphereFluids.length > 0) {
tagCompound.setInteger("liquidSphereFluid", Block.REGISTRY.getIDForObject(liquidSphereFluids[0]));
}
setBlockMeta(tagCompound, canyonBlock, "canyonBlock");
tagCompound.setInteger("fluidBlock", Block.REGISTRY.getIDForObject(fluidForTerrain));
writeBlocksToNBT(tagCompound, extraOregen, "extraOregen");
writeFluidsToNBT(tagCompound, fluidsForLakes, "lakeFluids");
tagCompound.setBoolean("peaceful", peaceful);
tagCompound.setBoolean("noanimals", noanimals);
tagCompound.setBoolean("shelter", shelter);
tagCompound.setBoolean("respawnHere", respawnHere);
tagCompound.setBoolean("cheater", cheater);
if (celestialAngle != null) {
tagCompound.setFloat("celestialAngle", celestialAngle);
}
if (timeSpeed != null) {
tagCompound.setFloat("timeSpeed", timeSpeed);
}
tagCompound.setInteger("probes", probeCounter);
tagCompound.setInteger("actualCost", actualRfCost);
skyDescriptor.writeToNBT(tagCompound);
weatherDescriptor.writeToNBT(tagCompound);
tagCompound.setLong("patreon1", patreon1);
NBTTagList list = new NBTTagList();
for (MobDescriptor mob : extraMobs) {
NBTTagCompound tc = new NBTTagCompound();
if (mob != null) {
if (mob.getEntityClass() != null) {
tc.setString("class", mob.getEntityClass().getName());
tc.setInteger("chance", mob.getSpawnChance());
tc.setInteger("minGroup", mob.getMinGroup());
tc.setInteger("maxGroup", mob.getMaxGroup());
tc.setInteger("maxLoaded", mob.getMaxLoaded());
list.appendTag(tc);
}
}
}
tagCompound.setTag("mobs", list);
tagCompound.setString("dimensionTypes", StringUtils.join(dimensionTypes, ","));
}
Aggregations