use of net.minecraft.util.math.ChunkPos in project ImmersiveEngineering by BluSunrize.
the class IEWorldGen method serverWorldTick.
@SubscribeEvent
public void serverWorldTick(TickEvent.WorldTickEvent event) {
if (event.side == Side.CLIENT || event.phase == TickEvent.Phase.START)
return;
int dimension = event.world.provider.getDimension();
int counter = 0;
List<ChunkPos> chunks = retrogenChunks.get(dimension);
if (chunks != null && chunks.size() > 0)
for (int i = 0; i < 2; i++) {
chunks = retrogenChunks.get(dimension);
if (chunks == null || chunks.size() <= 0)
break;
counter++;
ChunkPos loc = chunks.get(0);
long worldSeed = event.world.getSeed();
Random fmlRandom = new Random(worldSeed);
long xSeed = (fmlRandom.nextLong() >> 3);
long zSeed = (fmlRandom.nextLong() >> 3);
fmlRandom.setSeed(xSeed * loc.chunkXPos + zSeed * loc.chunkZPos ^ worldSeed);
this.generateOres(fmlRandom, loc.chunkXPos, loc.chunkZPos, event.world, false);
chunks.remove(0);
}
if (counter > 0 && IEConfig.Ores.retrogen_log_remaining)
IELogger.info("Retrogen was performed on " + counter + " Chunks, " + Math.max(0, chunks.size()) + " chunks remaining");
}
use of net.minecraft.util.math.ChunkPos 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.ChunkPos in project Railcraft by Railcraft.
the class ChunkManager method getBufferAround.
/**
* Returns a Set of ChunkCoordIntPair containing the chunks around point [x,
* z]. Coordinates are in world coordinates, not chunk coordinates.
*
* @param xWorld World x-Coord
* @param zWorld World z-Coord
* @param radius Distance from [x, z] to include, in blocks.
* @return A set of chunks.
*/
public Set<ChunkPos> getBufferAround(int xWorld, int zWorld, int radius) {
int minX = (xWorld - radius) >> 4;
int maxX = (xWorld + radius) >> 4;
int minZ = (zWorld - radius) >> 4;
int maxZ = (zWorld + radius) >> 4;
Set<ChunkPos> chunkList = new HashSet<ChunkPos>();
for (int xx = minX; xx <= maxX; xx++) {
for (int zz = minZ; zz <= maxZ; zz++) {
chunkList.add(new ChunkPos(xx, zz));
}
}
return chunkList;
}
use of net.minecraft.util.math.ChunkPos in project Railcraft by Railcraft.
the class ClientEffectProxy method chunkLoaderEffect.
@Override
public void chunkLoaderEffect(World world, Object source, Set<ChunkPos> chunks) {
if (!isGoggleAuraActive(GoggleAura.WORLDSPIKE))
return;
IEffectSource es = EffectManager.getEffectSource(source);
Vec3d sourcePos = es.getPosF();
if (FMLClientHandler.instance().getClient().thePlayer.getDistanceSq(sourcePos.xCoord, sourcePos.yCoord, sourcePos.zCoord) > 25600)
return;
for (ChunkPos chunk : chunks) {
int xCorner = chunk.chunkXPos * 16;
int zCorner = chunk.chunkZPos * 16;
double yCorner = sourcePos.yCoord - 8;
// System.out.println(xCorner + ", " + zCorner);
if (rand.nextInt(3) == 0) {
if (thinParticles(false))
continue;
double xParticle = xCorner + rand.nextFloat() * 16;
double yParticle = yCorner + rand.nextFloat() * 16;
double zParticle = zCorner + rand.nextFloat() * 16;
Particle particle = new ParticleChunkLoader(world, new Vec3d(xParticle, yParticle, zParticle), es);
spawnParticle(particle);
}
}
}
use of net.minecraft.util.math.ChunkPos in project Realistic-Terrain-Generation by Team-RTG.
the class VolcanoGenerator method rMapVolcanoes.
public void rMapVolcanoes(ChunkPrimer primer, World world, IBiomeProviderRTG cmr, int baseX, int baseY, int chunkX, int chunkY, OpenSimplexNoise simplex, CellNoise cell, float[] noise) {
// Have volcanoes been disabled in the global config?
if (!rtgConfig.ENABLE_VOLCANOES.get())
return;
// Let's go ahead and generate the volcano. Exciting!!! :D
if (baseX % 4 == 0 && baseY % 4 == 0) {
int biomeId = Biome.getIdForBiome(cmr.getBiomeGenAt(baseX * 16, baseY * 16));
RealisticBiomeBase realisticBiome = getBiome(biomeId);
// Do we need to patch the biome?
if (realisticBiome == null) {
RealisticBiomePatcher biomePatcher = new RealisticBiomePatcher();
realisticBiome = biomePatcher.getPatchedRealisticBiome("NULL biome found when mapping volcanoes.");
}
if (!realisticBiome.getConfig().ALLOW_VOLCANOES.get())
return;
// Have volcanoes been disabled via frequency?
// Use the global frequency unless the biome frequency has been explicitly set.
int chance = realisticBiome.getConfig().VOLCANO_CHANCE.get() == -1 ? rtgConfig.VOLCANO_CHANCE.get() : realisticBiome.getConfig().VOLCANO_CHANCE.get();
if (chance < 1)
return;
if (mapRand.nextInt(chance) > 0)
return;
float river = cmr.getRiverStrength(baseX * 16, baseY * 16) + 1f;
if (river > 0.98f && cmr.isBorderlessAt(baseX * 16, baseY * 16)) {
// we have to pull it out of noVolcano. We do it this way to avoid having to make a ChunkPos twice
ChunkPos probe = new ChunkPos(baseX, baseY);
noVolcano.remove(probe);
long i1 = mapRand.nextLong() / 2L * 2L + 1L;
long j1 = mapRand.nextLong() / 2L * 2L + 1L;
mapRand.setSeed((long) chunkX * i1 + (long) chunkY * j1 ^ world.getSeed());
WorldGenVolcano.build(primer, world, mapRand, baseX, baseY, chunkX, chunkY, simplex, cell, noise);
}
}
}
Aggregations