aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/australia/gen/world
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/australia/gen/world')
-rw-r--r--src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java87
-rw-r--r--src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java250
2 files changed, 0 insertions, 337 deletions
diff --git a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java
deleted file mode 100644
index 9adb84eef2..0000000000
--- a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianOre.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package gtPlusPlus.australia.gen.world;
-
-import java.util.Random;
-
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.math.MathUtils;
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
-import net.minecraft.util.MathHelper;
-import net.minecraft.world.World;
-import net.minecraft.world.gen.feature.WorldGenerator;
-
-public class WorldGenAustralianOre extends WorldGenerator {
-
- private Block mOreToSpawn;
- private int numberOfBlocks;
- private Block mBlockToReplace;
- private int mineableBlockMeta;
-
- public WorldGenAustralianOre(Block aBlock, int aNumber) {
- this(aBlock, aNumber, Blocks.stone);
- this.mineableBlockMeta = 0;
- }
-
- public WorldGenAustralianOre(Block aBlock, int aNumber, Block aReplace) {
- this.mOreToSpawn = aBlock;
- this.numberOfBlocks = aNumber;
- this.mBlockToReplace = aReplace;
- }
-
- public WorldGenAustralianOre(Block block, int meta, int number, Block target) {
- this(block, number, target);
- this.mineableBlockMeta = meta;
- }
-
-
-
- public boolean generate(World aWorld, Random aRand, int aX, int aY, int aZ) {
- float f = MathUtils.randFloat(0f, 1.5f) * CORE.PI;
- double d0 = (double) ((float) (aX + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
- double d1 = (double) ((float) (aX + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F);
- double d2 = (double) ((float) (aZ + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);
- double d3 = (double) ((float) (aZ + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F);
- double d4 = (double) (aY + aRand.nextInt(MathUtils.randInt(3, 6)) - 2);
- double d5 = (double) (aY + aRand.nextInt(MathUtils.randInt(3, 6)) - 2);
-
- for (int aOreGenerated = 0; aOreGenerated <= this.numberOfBlocks; ++aOreGenerated) {
- double d6 = d0 + (d1 - d0) * (double) aOreGenerated / (double) this.numberOfBlocks;
- double d7 = d4 + (d5 - d4) * (double) aOreGenerated / (double) this.numberOfBlocks;
- double d8 = d2 + (d3 - d2) * (double) aOreGenerated / (double) this.numberOfBlocks;
- double d9 = aRand.nextDouble() * (double) this.numberOfBlocks / 16.0D;
- double d10 = (double) (MathHelper.sin((float) aOreGenerated * CORE.PI / (float) this.numberOfBlocks) + 1.0F)
- * d9 + 1.0D;
- double d11 = (double) (MathHelper.sin((float) aOreGenerated * CORE.PI / (float) this.numberOfBlocks) + 1.0F)
- * d9 + 1.0D;
- int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);
- int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);
- int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);
- int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);
- int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);
- int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);
-
- for (int k2 = i1; k2 <= l1; ++k2) {
- double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D);
-
- if (d12 * d12 < 1.0D) {
- for (int l2 = j1; l2 <= i2; ++l2) {
- double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D);
-
- if (d12 * d12 + d13 * d13 < 1.0D) {
- for (int i3 = k1; i3 <= j2; ++i3) {
- double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D);
-
- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && aWorld.getBlock(k2, l2, i3)
- .isReplaceableOreGen(aWorld, k2, l2, i3, mBlockToReplace)) {
- aWorld.setBlock(k2, l2, i3, this.mOreToSpawn, mineableBlockMeta, 2);
- }
- }
- }
- }
- }
- }
- }
-
- return true;
- }
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java b/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java
deleted file mode 100644
index f3529aff0b..0000000000
--- a/src/Java/gtPlusPlus/australia/gen/world/WorldGenAustralianTrees.java
+++ /dev/null
@@ -1,250 +0,0 @@
-package gtPlusPlus.australia.gen.world;
-
-import java.util.Random;
-
-import gtPlusPlus.core.util.math.MathUtils;
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockSapling;
-import net.minecraft.block.material.Material;
-import net.minecraft.init.Blocks;
-import net.minecraft.util.Direction;
-import net.minecraft.world.World;
-import net.minecraft.world.gen.feature.WorldGenTrees;
-import net.minecraftforge.common.util.ForgeDirection;
-
-public class WorldGenAustralianTrees extends WorldGenTrees {
-
- /** The minimum height of a generated tree. */
- private final int minHeight;
- /** True if this tree should grow Vines. */
- private final boolean growVines;
- /** The metadata value of the wood to use in tree generation. */
- private final int woodMeta;
- /** The metadata value of the leaves to use in tree generation. */
- private final int leavesMeta;
-
- public WorldGenAustralianTrees(boolean p_i2027_1_) {
- this(p_i2027_1_, 4, false);
- }
-
- public WorldGenAustralianTrees(boolean p_i2028_1_, int aMinHeight, boolean aVinesGrow) {
- super(p_i2028_1_, aMinHeight, 0, 0, aVinesGrow);
- this.minHeight = aMinHeight;
- this.woodMeta = 0;
- this.leavesMeta = 0;
- this.growVines = aVinesGrow;
- }
-
- public boolean generate(World aWorld, Random aRand, int aX, int aY, int aZ) {
- int aActualMinHeight = MathUtils.randInt(4, 8) + this.minHeight;
- boolean flag = true;
-
- if (aY >= 1 && aY + aActualMinHeight + 1 <= 256) {
- byte b0;
- int k1;
- Block block;
-
- for (int i1 = aY; i1 <= aY + 1 + aActualMinHeight; ++i1) {
- b0 = 1;
-
- if (i1 == aY) {
- b0 = 0;
- }
-
- if (i1 >= aY + 1 + aActualMinHeight - 2) {
- b0 = 2;
- }
-
- for (int j1 = aX - b0; j1 <= aX + b0 && flag; ++j1) {
- for (k1 = aZ - b0; k1 <= aZ + b0 && flag; ++k1) {
- if (i1 >= 0 && i1 < 256) {
- block = aWorld.getBlock(j1, i1, k1);
-
- if (!this.isReplaceable(aWorld, j1, i1, k1)) {
- flag = false;
- }
- } else {
- flag = false;
- }
- }
- }
- }
-
- if (!flag) {
- return false;
- } else {
- Block block2 = aWorld.getBlock(aX, aY - 1, aZ);
- boolean isSoil = true;
- for (int gh = 0; gh < 5; gh++) {
- int xMod, zMod;
- if (gh == 0) {
- xMod = 1;
- zMod = 0;
- }
- else if (gh == 1) {
- xMod = 0;
- zMod = 1;
- }
- else if (gh == 2) {
- xMod = -1;
- zMod = 0;
- }
- else if (gh == 3) {
- xMod = 0;
- zMod = -1;
- }
- else {
- xMod = 0;
- zMod = 0;
- }
- block2 = aWorld.getBlock(aX+xMod, aY - 1, aZ+zMod);
- if (block2 == Blocks.air || !block2.canSustainPlant(aWorld, aX+xMod, aY - 1, aZ+zMod, ForgeDirection.UP, (BlockSapling) Blocks.sapling)) {
- isSoil = false;
- break;
- }
- }
-
- if (isSoil && aY < 256 - aActualMinHeight - 1) {
- block2.onPlantGrow(aWorld, aX, aY - 1, aZ, aX, aY, aZ);
- b0 = 5;
- byte b1 = 0;
- int l1;
- int i2;
- int j2;
- int i3;
-
- for (k1 = aY - b0 + aActualMinHeight; k1 <= aY + aActualMinHeight; ++k1) {
- i3 = k1 - (aY + aActualMinHeight);
- l1 = b1 + 3 - i3 / 2;
-
- for (i2 = aX - l1; i2 <= aX + l1; ++i2) {
- j2 = i2 - aX;
-
- for (int k2 = aZ - l1; k2 <= aZ + l1; ++k2) {
- int l2 = k2 - aZ;
-
- if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || aRand.nextInt(2) != 0 && i3 != 0) {
- Block block1 = aWorld.getBlock(i2, k1, k2);
-
- if (block1.isAir(aWorld, i2, k1, k2) || block1.isLeaves(aWorld, i2, k1, k2)) {
- this.setBlockAndNotifyAdequately(aWorld, i2, k1, k2, Blocks.leaves,
- this.leavesMeta);
- }
- }
- }
- }
- }
-
- for (k1 = 0; k1 < aActualMinHeight; ++k1) {
- block = aWorld.getBlock(aX, aY + k1, aZ);
-
- if (block.isAir(aWorld, aX, aY + k1, aZ) || block.isLeaves(aWorld, aX, aY + k1, aZ)) {
-
- //Set Middle Trunk
- this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ, Blocks.log, this.woodMeta);
- //Set Sides
- if (k1 < (aActualMinHeight - 2)) {
- if (aWorld.isAirBlock(aX+1, aY + k1, aZ) || block.isLeaves(aWorld, aX+1, aY + k1, aZ)) this.setBlockAndNotifyAdequately(aWorld, aX+1, aY + k1, aZ, Blocks.log, this.woodMeta);
- if (aWorld.isAirBlock(aX-1, aY + k1, aZ) || block.isLeaves(aWorld, aX-1, aY + k1, aZ)) this.setBlockAndNotifyAdequately(aWorld, aX-1, aY + k1, aZ, Blocks.log, this.woodMeta);
- if (aWorld.isAirBlock(aX, aY + k1, aZ+1) || block.isLeaves(aWorld, aX, aY + k1, aZ+1)) this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ+1, Blocks.log, this.woodMeta);
- if (aWorld.isAirBlock(aX, aY + k1, aZ-1) || block.isLeaves(aWorld, aX, aY + k1, aZ-1)) this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ-1, Blocks.log, this.woodMeta);
- }
-
- if (this.growVines && k1 > 0) {
- if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX - 1, aY + k1, aZ)) {
- this.setBlockAndNotifyAdequately(aWorld, aX - 1, aY + k1, aZ, Blocks.vine, 8);
- }
-
- if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX + 1, aY + k1, aZ)) {
- this.setBlockAndNotifyAdequately(aWorld, aX + 1, aY + k1, aZ, Blocks.vine, 2);
- }
-
- if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX, aY + k1, aZ - 1)) {
- this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ - 1, Blocks.vine, 1);
- }
-
- if (aRand.nextInt(3) > 0 && aWorld.isAirBlock(aX, aY + k1, aZ + 1)) {
- this.setBlockAndNotifyAdequately(aWorld, aX, aY + k1, aZ + 1, Blocks.vine, 4);
- }
- }
- }
- }
-
- if (this.growVines) {
- for (k1 = aY - 3 + aActualMinHeight; k1 <= aY + aActualMinHeight; ++k1) {
- i3 = k1 - (aY + aActualMinHeight);
- l1 = 2 - i3 / 2;
-
- for (i2 = aX - l1; i2 <= aX + l1; ++i2) {
- for (j2 = aZ - l1; j2 <= aZ + l1; ++j2) {
- if (aWorld.getBlock(i2, k1, j2).isLeaves(aWorld, i2, k1, j2)) {
- if (aRand.nextInt(4) == 0
- && aWorld.getBlock(i2 - 1, k1, j2).isAir(aWorld, i2 - 1, k1, j2)) {
- this.growVines(aWorld, i2 - 1, k1, j2, 8);
- }
-
- if (aRand.nextInt(4) == 0
- && aWorld.getBlock(i2 + 1, k1, j2).isAir(aWorld, i2 + 1, k1, j2)) {
- this.growVines(aWorld, i2 + 1, k1, j2, 2);
- }
-
- if (aRand.nextInt(4) == 0
- && aWorld.getBlock(i2, k1, j2 - 1).isAir(aWorld, i2, k1, j2 - 1)) {
- this.growVines(aWorld, i2, k1, j2 - 1, 1);
- }
-
- if (aRand.nextInt(4) == 0
- && aWorld.getBlock(i2, k1, j2 + 1).isAir(aWorld, i2, k1, j2 + 1)) {
- this.growVines(aWorld, i2, k1, j2 + 1, 4);
- }
- }
- }
- }
- }
-
- if (aRand.nextInt(5) == 0 && aActualMinHeight > 5) {
- for (k1 = 0; k1 < 2; ++k1) {
- for (i3 = 0; i3 < 4; ++i3) {
- if (aRand.nextInt(4 - k1) == 0) {
- l1 = aRand.nextInt(3);
- this.setBlockAndNotifyAdequately(aWorld,
- aX + Direction.offsetX[Direction.rotateOpposite[i3]], aY + aActualMinHeight - 5 + k1,
- aZ + Direction.offsetZ[Direction.rotateOpposite[i3]], Blocks.cocoa,
- l1 << 2 | i3);
- }
- }
- }
- }
- }
-
- return true;
- } else {
- return false;
- }
- }
- } else {
- return false;
- }
- }
-
- /**
- * Grows vines downward from the given block for a given length. Args: World, x,
- * starty, z, vine-length
- */
- private void growVines(World p_76529_1_, int p_76529_2_, int p_76529_3_, int p_76529_4_, int p_76529_5_) {
- this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_);
- int i1 = 4;
-
- while (true) {
- --p_76529_3_;
-
- if (!p_76529_1_.getBlock(p_76529_2_, p_76529_3_, p_76529_4_).isAir(p_76529_1_, p_76529_2_, p_76529_3_,
- p_76529_4_) || i1 <= 0) {
- return;
- }
-
- this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_);
- --i1;
- }
- }
-} \ No newline at end of file