Improved Gold Dungeon trees.

This commit is contained in:
bconlon 2020-07-18 15:49:10 -07:00
parent d843eee198
commit e7ec977e08
4 changed files with 84 additions and 14 deletions

View file

@ -2,6 +2,7 @@ package com.legacy.aether.world.biome;
import java.util.Random;
import com.legacy.aether.world.biome.decoration.*;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
@ -13,16 +14,6 @@ import net.minecraft.world.gen.feature.WorldGenerator;
import com.legacy.aether.AetherConfig;
import com.legacy.aether.blocks.BlocksAether;
import com.legacy.aether.world.biome.decoration.AetherGenClouds;
import com.legacy.aether.world.biome.decoration.AetherGenFloatingIsland;
import com.legacy.aether.world.biome.decoration.AetherGenFoilage;
import com.legacy.aether.world.biome.decoration.AetherGenHolidayTree;
import com.legacy.aether.world.biome.decoration.AetherGenLakes;
import com.legacy.aether.world.biome.decoration.AetherGenLiquids;
import com.legacy.aether.world.biome.decoration.AetherGenMinable;
import com.legacy.aether.world.biome.decoration.AetherGenOakTree;
import com.legacy.aether.world.biome.decoration.AetherGenQuicksoil;
import com.legacy.aether.world.biome.decoration.AetherGenSkyrootTree;
public class AetherBiomeDecorator extends BiomeDecorator {
@ -38,6 +29,8 @@ public class AetherBiomeDecorator extends BiomeDecorator {
public AetherGenSkyrootTree skyroot_tree = new AetherGenSkyrootTree(false);
public AetherGenDungeonOakTree golden_oak_tree_dungeon = new AetherGenDungeonOakTree();
public AetherGenQuicksoil quicksoil_patches = new AetherGenQuicksoil();
public AetherGenFloatingIsland crystal_island = new AetherGenFloatingIsland();
@ -113,6 +106,14 @@ public class AetherBiomeDecorator extends BiomeDecorator {
}
}
for (int i = 0; i < 25; i++)
{
int x = this.chunk_X + this.nextInt(16);
int z = this.chunk_Z + this.nextInt(16);
int y = this.world.getHeightValue(x, z);
this.golden_oak_tree_dungeon.generate(this.world, this.rand, x, y, z);
}
if (AetherConfig.tallgrassEnabled()) {
for (int i3 = 0; i3 < 10; ++i3) {
int j7 = this.chunk_X + this.rand.nextInt(16) + 8;

View file

@ -0,0 +1,69 @@
package com.legacy.aether.world.biome.decoration;
import com.legacy.aether.blocks.BlocksAether;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import java.util.Random;
public class AetherGenDungeonOakTree extends WorldGenAbstractTree {
public AetherGenDungeonOakTree() {
super(true);
}
public boolean branch(World world, Random random, int x, int y, int z, int slant) {
int directionX = random.nextInt(3) - 1;
int directionY = slant;
int directionZ = random.nextInt(3) - 1;
int i = x;
int k = z;
for (int n = 0; n < random.nextInt(2); n++) {
x += directionX;
y += directionY;
z += directionZ;
i -= directionX;
k -= directionZ;
if (world.getBlock(x, y, z) == BlocksAether.golden_oak_leaves) {
world.setBlock(x, y, z, BlocksAether.golden_oak_log);
world.setBlock(i, y, k, BlocksAether.golden_oak_log);
}
}
return true;
}
@Override
public boolean generate(World world, Random random, int x, int y, int z) {
if (world.getBlock(x, y - 1, z) != BlocksAether.aether_grass || world.getBlockMetadata(x, y - 1, z) != 3) {
return false;
}
int height = 9;
for (int x1 = x - 3; x1 < x + 4; x1++) {
for (int y1 = y + 5; y1 < y + 12; y1++) {
for (int z1 = z - 3; z1 < z + 4; z1++) {
if ((x1 - x) * (x1 - x) + (y1 - y - 8) * (y1 - y - 8) + (z1 - z) * (z1 - z) < 12 + random.nextInt(5) && world.isAirBlock(x1, y1, z1)) {
world.setBlock(x1, y1, z1, BlocksAether.golden_oak_leaves);
}
}
}
}
for (int n = 0; n < height; n++) {
if (n > 4) {
if (random.nextInt(3) > 0) {
branch(world, random, x, y + n, z, n / 4 - 1);
}
}
world.setBlock(x, y + n, z, BlocksAether.golden_oak_log);
}
return true;
}
}

View file

@ -63,7 +63,7 @@ public class ComponentGoldenIsland extends AetherStructure {
if (Math.sqrt(k3 * k3 + i4 * i4 + k4 * k4) <= 24.0D) {
if (BlocksAether.isGood(this.getBlockStateWithOffset(i2, l2 + 1, i3)) && l2 > 4) {
this.setBlockWithOffset(i2, l2, i3, BlocksAether.aether_grass, 0);
this.setBlockWithOffset(i2, l2, i3, BlocksAether.aether_grass, 3);
this.setBlockWithOffset(i2, l2 - 1, i3, BlocksAether.aether_dirt, 0);
this.setBlockWithOffset(i2, l2 - (1 + this.random.nextInt(2)), i3, BlocksAether.aether_dirt, 0);
@ -71,7 +71,7 @@ public class ComponentGoldenIsland extends AetherStructure {
int j5 = this.random.nextInt(48);
if (j5 < 2) {
AetherGenUtils.generateGoldenOakTree(this, i2, l2 + 1, i3);
//AetherGenUtils.generateGoldenOakTree(this, i2, l2 + 1, i3);
} else if (j5 == 3) {
if (this.random.nextInt(2) == 0) {
//new WorldGenLakes(Blocks.FLOWING_WATER).generate(world, random, new BlockPos.MutableBlockPos((i2 + i + random.nextInt(3)) - random.nextInt(3), l2 + j, (i3 + k + random.nextInt(3)) - random.nextInt(3)));

View file

@ -51,7 +51,7 @@ public class ComponentGoldenIslandStub extends AetherStructure {
if (Math.sqrt(k2 * k2 + i3 * i3 + k3 * k3) <= 8.0D) {
if (BlocksAether.isGood(this.getBlockStateWithOffset(i1 + x, k1 + y + 1, i2 + z)) && k1 > 1) {
this.setBlockWithOffset(i1 + x, k1 + y, i2 + z, BlocksAether.aether_grass, 0);
this.setBlockWithOffset(i1 + x, k1 + y, i2 + z, BlocksAether.aether_grass, 3);
this.setBlockWithOffset(i1 + x, (k1 + y) - 1, i2 + z, BlocksAether.aether_dirt, 0);
this.setBlockWithOffset(i1 + x, (k1 + y) - (1 + this.random.nextInt(2)), i2 + z, BlocksAether.aether_dirt, 0);
@ -59,7 +59,7 @@ public class ComponentGoldenIslandStub extends AetherStructure {
int l3 = this.random.nextInt(64);
if (l3 == 0) {
AetherGenUtils.generateGoldenOakTree(this, i1 + x, k1 + y + 1, i2 + z);
//AetherGenUtils.generateGoldenOakTree(this, i1 + x, k1 + y + 1, i2 + z);
} else if (l3 == 5) {
if (this.random.nextInt(3) == 0) {
//new WorldGenLakes(Blocks.FLOWING_WATER).generate(world, random, new BlockPos.MutableBlockPos((i1 + i + random.nextInt(3)) - random.nextInt(3), k1 + j, (i2 + k + random.nextInt(3)) - random.nextInt(3)));