mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Remove now defunct test namespace.
This commit is contained in:
1 parent
5e0ee6f947
commit
f287c5fd13
2 files changed
-163
No files matched your search
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Hologuardian>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jul 8, 2014, 6:01:55 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.test;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class MassiveAssTree extends WorldGenerator {
|
||||
|
||||
public void generateTrunk(World world, Random rand, int x, int y, int z, int radius, int height) {
|
||||
for(int i = x - radius; i < x + radius; ++i)
|
||||
for(int j = y; j <= y + height && y < 256; ++j)
|
||||
for(int k = z - radius; k < z + radius; ++k) {
|
||||
int y1 = height - (j - y) - rand.nextInt(radius / 2);
|
||||
if((i - x) * (i - x) + (k - z) * (k - z) <= radius * radius + y1)
|
||||
world.setBlock(i, j, k, ModBlocks.livingwood);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateCanopy(World world, Random rand, int x, int y, int z, int radius, int height) {
|
||||
float uDiv = radius * radius / (height / 2);
|
||||
float lDiv = radius * radius / (height / 2);
|
||||
for(int i = x - radius; i < x + radius; ++i)
|
||||
for(float k = z - radius; k < z + radius; ++k)
|
||||
for(float j = y + height; j >= 0 && j < 256; --j) {
|
||||
float bx = i - x;
|
||||
float by = j - y;
|
||||
float bz = k - z;
|
||||
if (inCanopy(bx, by, bz, radius, height, lDiv, uDiv))
|
||||
world.setBlock(i, (int)j, (int)k, Blocks.leaves, 3, 1 | 2);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inCanopy(float x, float y, float z, float r, float h, float d, float uD) {
|
||||
if(y <= upperCanopyY(x, y, z, r, h, uD) && y >= lowerCanopyY(x, y, z, r, h, d))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public float lowerCanopyY(float x, float y, float z, float r, float h, float div) {
|
||||
return (x * x + z * z) / div;
|
||||
}
|
||||
|
||||
public float upperCanopyY(float x, float y, float z, float r, float h, float div) {
|
||||
return h - (x * x + z * z) / div;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random rand, int x, int y, int z) {
|
||||
float scale = rand.nextFloat() * 0.5F + 1.0F;
|
||||
int height = (int)((30 + rand.nextInt(10)) * scale);
|
||||
generateTrunk(world, rand, x, y, z, (int)(3 * scale), height);
|
||||
generateCanopy(world, rand, x, y + height, z, 30 + rand.nextInt(15), 10 + rand.nextInt(5));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Mar 22, 2014, 4:43:32 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.test;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class WorldTreeGenerator {
|
||||
|
||||
World world;
|
||||
int srcx, srcy, srcz;
|
||||
|
||||
int x, y, z;
|
||||
|
||||
int blocksPlaced;
|
||||
|
||||
public WorldTreeGenerator(World world, int srcx, int srcy, int srcz) {
|
||||
this.world = world;
|
||||
this.srcx = srcx;
|
||||
this.srcy = srcy;
|
||||
this.srcz = srcz;
|
||||
}
|
||||
|
||||
public void generate() {
|
||||
for(int i = 0; i < 156; i++) {
|
||||
generateRing(i, (int) Math.sqrt(256 - (Math.min(i, 100) - 5) * 2) * 2);
|
||||
generateRing(i, (int) (Math.sqrt(256 - (Math.min(i, 100) - 5) * 2) * 2) - 1);
|
||||
}
|
||||
|
||||
System.out.println("Blocks Placed: " + blocksPlaced);
|
||||
}
|
||||
|
||||
public void generateRing(int yoff, int radius) {
|
||||
Block block = ModBlocks.dreamwood;
|
||||
y = yoff;
|
||||
|
||||
for(int i = 0; i < 720; i++) {
|
||||
if(i % 90 == 0)
|
||||
continue;
|
||||
|
||||
int meta = world.rand.nextInt(20) == 0 ? 5 : 0;
|
||||
generateRingVal(radius, i * 0.5F, block, meta);
|
||||
}
|
||||
|
||||
int mul = 4;
|
||||
for(int i = 0; i < mul; i++)
|
||||
for(int j = 0; j < mul; j++) {
|
||||
int meta = world.rand.nextInt(4) == 0 ? 5 : 0;
|
||||
int angle = (y - j) * mul % 720;
|
||||
|
||||
generateRingVal(radius - i - 3, angle, block, meta);
|
||||
generateRingVal(radius - i - 3, angle + 180, block, meta);
|
||||
}
|
||||
|
||||
mul = 2;
|
||||
|
||||
for(int i = 0; i < mul; i++)
|
||||
for(int j = 0; j < mul; j++) {
|
||||
int meta = world.rand.nextInt(5) == 0 ? 5 : 0;
|
||||
int angle = (y - j) * mul % 720;
|
||||
generateRingVal(radius + i + 2, angle + 90, block, meta);
|
||||
generateRingVal(radius + i + 2, angle + 270, block, meta);
|
||||
generateRingVal(radius + i + 2, angle + 180, block, meta);
|
||||
generateRingVal(radius + i + 2, angle, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateRingVal(int radius, float angle, Block block, int meta) {
|
||||
int nx = (int) (Math.cos(angle * Math.PI / 180D) * radius);
|
||||
int nz = (int) (Math.sin(angle * Math.PI / 180D) * radius);
|
||||
|
||||
if(x != nx || z != nz) {
|
||||
x = nx;
|
||||
z = nz;
|
||||
place(srcx + x, srcy + y, srcz + z, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void place(int x, int y, int z, Block block, int meta) {
|
||||
world.setBlock(x, y, z, block, meta, 2);
|
||||
blocksPlaced++;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user