use of net.minecraft.world.biome.Biome in project Traverse by ProfessorProspector.
the class CommandFindTest method execute.
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
Biome biome = null;
for (Biome b : TraverseWorld.biomeList.keySet()) {
String name = b.getBiomeName().replaceAll(" ", "_").toLowerCase();
if (args[0].equalsIgnoreCase(name)) {
biome = b;
}
}
if (biome == null) {
return;
}
long start = System.currentTimeMillis();
BlockPos pos = spiralOutwardsLookingForBiome(sender.getEntityWorld(), biome, sender.getPosition().getX(), sender.getPosition().getZ());
System.out.println(pos);
System.out.println((System.currentTimeMillis() - start) + "ms");
if (sender instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) sender;
playerMP.connection.setPlayerLocation(pos.getX(), 150, pos.getZ(), 0, 0);
}
}
use of net.minecraft.world.biome.Biome in project Railcraft by Railcraft.
the class TileTankWater method update.
@Override
public void update() {
super.update();
if (Game.isHost(getWorld())) {
if (isMaster()) {
if (worldObj.provider.getDimension() != -1 && clock % REFILL_INTERVAL == 0) {
float rate = REFILL_RATE;
Biome biome = worldObj.getBiome(getPos());
float humidity = biome.getRainfall();
rate *= humidity;
// String debug = "Biome=" + biome.biomeName + ", Humidity=" + humidity;
boolean outside = false;
for (int x = getX() - 1; x <= getX() + 1; x++) {
for (int z = getZ() - 1; z <= getZ() + 1; z++) {
outside = worldObj.canBlockSeeSky(new BlockPos(x, getY() + 3, z));
// System.out.println(x + ", " + (yCoord + 3) + ", " + z);
if (outside)
break;
}
}
// debug += ", Outside=" + outside;
if (!outside)
rate *= REFILL_PENALTY_INSIDE;
else if (worldObj.isRaining())
if (biome.getEnableSnow())
// debug += ", Snow=true";
rate *= REFILL_PENALTY_SNOW;
else
// debug += ", Rain=true";
rate *= REFILL_BOOST_RAIN;
int rateFinal = MathHelper.floor_float(rate);
if (rateFinal < REFILL_RATE_MIN)
rateFinal = REFILL_RATE_MIN;
// debug += ", Refill=" + rateFinal;
// System.out.println(debug);
FluidStack fillStack = Fluids.WATER.get(rateFinal);
tank.fillInternal(fillStack, true);
}
//FIXME
// if (clock % FluidTools.BUCKET_FILL_TIME == 0)
// FluidTools.processContainers(tankManager.get(0), this, SLOT_INPUT, SLOT_OUTPUT);
}
TankManager tMan = getTankManager();
if (tMan != null)
tMan.push(tileCache, Predicates.notInstanceOf(getClass()), LIQUID_OUTPUTS, 0, OUTPUT_RATE);
}
}
use of net.minecraft.world.biome.Biome in project RFToolsDimensions by McJty.
the class MapGenDenseCaves method isTopBlock.
// Determine if the block at the specified location is the top block for the biome, we take into account
// Vanilla bugs to make sure that we generate the map the same way vanilla does.
private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) {
net.minecraft.world.biome.Biome biome = w.getBiomeForCoordsBody(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
IBlockState state = data.getBlockState(x, y, z);
return (isExceptionBiome(biome) ? state.getBlock() == Blocks.GRASS : state.getBlock() == biome.topBlock);
}
use of net.minecraft.world.biome.Biome in project RFToolsDimensions by McJty.
the class IslandTerrainGenerator method replaceBlocksForBiome.
@Override
public void replaceBlocksForBiome(int chunkX, int chunkZ, ChunkPrimer primer, Biome[] Biomes) {
// ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(provider, chunkX, chunkZ, aBlock, abyte, Biomes, world);
// MinecraftForge.EVENT_BUS.post(event);
// if (event.getResult() == Event.Result.DENY) {
// return;
// }
double d0 = 0.03125D;
this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, (chunkX * 16), (chunkZ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
for (int k = 0; k < 16; ++k) {
for (int l = 0; l < 16; ++l) {
Biome Biome = Biomes[l + k * 16];
genBiomeTerrain(Biome, primer, chunkX * 16 + k, chunkZ * 16 + l, this.stoneNoise[l + k * 16]);
}
}
}
use of net.minecraft.world.biome.Biome in project RFToolsDimensions by McJty.
the class NormalTerrainGenerator method generateHeightmap.
protected void generateHeightmap(int chunkX4, int chunkY4, int chunkZ4) {
ChunkGeneratorSettings settings = provider.getSettings();
this.depthRegion = this.depthNoise.generateNoiseOctaves(this.depthRegion, chunkX4, chunkZ4, 5, 5, settings.depthNoiseScaleX, settings.depthNoiseScaleZ, settings.depthNoiseScaleExponent);
float f = settings.coordinateScale;
float f1 = settings.heightScale;
this.mainNoiseRegion = this.mainPerlinNoise.generateNoiseOctaves(this.mainNoiseRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f / settings.mainNoiseScaleX, f1 / settings.mainNoiseScaleY, f / settings.mainNoiseScaleZ);
this.minLimitRegion = this.minLimitPerlinNoise.generateNoiseOctaves(this.minLimitRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f, f1, f);
this.maxLimitRegion = this.maxLimitPerlinNoise.generateNoiseOctaves(this.maxLimitRegion, chunkX4, chunkY4, chunkZ4, 5, 33, 5, f, f1, f);
int i = 0;
int j = 0;
boolean domaze = false;
boolean elevated = false;
boolean donearlands = provider.dimensionInformation.getTerrainType() == TerrainType.TERRAIN_NEARLANDS;
if (donearlands) {
elevated = true;
}
if (provider.dimensionInformation.hasFeatureType(FeatureType.FEATURE_MAZE)) {
domaze = true;
long s2 = (((chunkX4 >> 2) + provider.seed + 13) * 314) + (chunkZ4 >> 2) * 17L;
Random rand = new Random(s2);
// Skip one.
rand.nextFloat();
elevated = ((chunkX4 >> 2) & 1) == 0;
if (rand.nextFloat() < .2f) {
elevated = !elevated;
}
}
if (donearlands) {
int cx = chunkX4 >> 2;
int cz = chunkZ4 >> 2;
if (Math.abs(cx) < 5 && Math.abs(cz) < 5) {
elevated = false;
}
}
if (provider.biomesForGeneration == null) {
Logging.log("Dimension " + world.provider.getDimension() + " has a problem! Ignoring for now.");
return;
}
for (int k = 0; k < 5; ++k) {
for (int l = 0; l < 5; ++l) {
float f2 = 0.0F;
float f3 = 0.0F;
float f4 = 0.0F;
Biome Biome = provider.biomesForGeneration[k + 2 + (l + 2) * 10];
for (int j1 = -2; j1 <= 2; ++j1) {
for (int k1 = -2; k1 <= 2; ++k1) {
Biome Biome1 = provider.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10];
float f5 = provider.getSettings().biomeDepthOffSet + Biome1.getBaseHeight() * provider.getSettings().biomeDepthWeight;
float f6 = provider.getSettings().biomeScaleOffset + Biome1.getHeightVariation() * provider.getSettings().biomeScaleWeight;
if (domaze || donearlands) {
if (f5 > 0.0F && elevated) {
if (provider.worldType == WorldType.AMPLIFIED) {
f5 = 2.0F + f5 * 1.5f;
f6 = 1.0F + f6 * 3.0f;
} else {
f5 = 2.0F + f5;
f6 = 0.5F + f6 * 1.5f;
}
} else {
if (provider.worldType == WorldType.AMPLIFIED && f5 > 0.0f) {
f5 = 0.5F + f5 * 1.5F;
f6 = 0.5F + f6 * 2.0F;
} else {
f6 = f6 * 0.5F;
}
}
} else {
if (provider.worldType == WorldType.AMPLIFIED && f5 > 0.0F) {
f5 = 1.0F + f5 * 2.0F;
f6 = 1.0F + f6 * 4.0F;
}
}
float f7 = biomeWeights[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F);
if (Biome1.getBaseHeight() > Biome.getBaseHeight()) {
f7 /= 2.0F;
}
f2 += f6 * f7;
f3 += f5 * f7;
f4 += f7;
}
}
f2 /= f4;
f3 /= f4;
f2 = f2 * 0.9F + 0.1F;
f3 = (f3 * 4.0F - 1.0F) / 8.0F;
double d12 = this.depthRegion[j] / 8000.0D;
if (d12 < 0.0D) {
d12 = -d12 * 0.3D;
}
d12 = d12 * 3.0D - 2.0D;
if (d12 < 0.0D) {
d12 /= 2.0D;
if (d12 < -1.0D) {
d12 = -1.0D;
}
d12 /= 1.4D;
d12 /= 2.0D;
} else {
if (d12 > 1.0D) {
d12 = 1.0D;
}
d12 /= 8.0D;
}
++j;
double d13 = f3;
double d14 = f2;
d13 += d12 * 0.2D;
d13 = d13 * 8.5D / 8.0D;
double d5 = 8.5D + d13 * 4.0D;
for (int j2 = 0; j2 < 33; ++j2) {
double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
if (d6 < 0.0D) {
d6 *= 4.0D;
}
double d7 = this.minLimitRegion[i] / 512.0D;
double d8 = this.maxLimitRegion[i] / 512.0D;
double d9 = (this.mainNoiseRegion[i] / 10.0D + 1.0D) / 2.0D;
double d10 = (d9 < 0.0D ? d7 : (d9 > 1.0D ? d8 : d7 + (d8 - d7) * d9)) - d6;
if (j2 > 29) {
double d11 = ((j2 - 29) / 3.0F);
d10 = d10 * (1.0D - d11) + -10.0D * d11;
}
this.heightMap[i] = d10;
++i;
}
}
}
}
Aggregations