-
Notifications
You must be signed in to change notification settings - Fork 3
/
GT_Worldgen_Stone_Space.java
93 lines (88 loc) · 4.78 KB
/
GT_Worldgen_Stone_Space.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package bloodasp.GalacticGreg;
import gregapi.old.GT_Worldgen_Ore;
import gregapi.block.prefixblock.PrefixBlockTileEntity;
import gregapi.data.CS;
import java.util.Collection;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
public class GT_Worldgen_Stone_Space
extends GT_Worldgen_Ore
{
public GT_Worldgen_Stone_Space(String aName, boolean aDefault, Block aBlock, int aBlockMeta, int aDimensionType, int aAmount, int aSize, int aProbability, int aMinY, int aMaxY, Collection<String> aBiomeList, boolean aAllowToGenerateinVoid)
{
super(aName, aDefault, aBlock, aBlockMeta, aDimensionType, aAmount, aSize, aProbability, aMinY, aMaxY, aBiomeList, aAllowToGenerateinVoid);
}
public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider)
{
if (((this.mBiomeList.isEmpty()) || (this.mBiomeList.contains(aBiome))) && ((this.mProbability <= 1) || (aRandom.nextInt(this.mProbability) == 0)))
{
for (int i = 0; i < this.mAmount; i++)
{
int tX = aChunkX + aRandom.nextInt(16);int tY = this.mMinY + aRandom.nextInt(this.mMaxY - this.mMinY);int tZ = aChunkZ + aRandom.nextInt(16);
if ((this.mAllowToGenerateinVoid) || (!aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)))
{
float var6 = aRandom.nextFloat() * 3.141593F;
double var7 = tX + 8 + MathHelper.sin(var6) * this.mSize / 8.0F;
double var9 = tX + 8 - MathHelper.sin(var6) * this.mSize / 8.0F;
double var11 = tZ + 8 + MathHelper.cos(var6) * this.mSize / 8.0F;
double var13 = tZ + 8 - MathHelper.cos(var6) * this.mSize / 8.0F;
double var15 = tY + aRandom.nextInt(3) - 2;
double var17 = tY + aRandom.nextInt(3) - 2;
for (int var19 = 0; var19 <= this.mSize; var19++)
{
double var20 = var7 + (var9 - var7) * var19 / this.mSize;
double var22 = var15 + (var17 - var15) * var19 / this.mSize;
double var24 = var11 + (var13 - var11) * var19 / this.mSize;
double var26 = aRandom.nextDouble() * this.mSize / 16.0D;
double var28 = (MathHelper.sin(var19 * 3.141593F / this.mSize) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * 3.141593F / this.mSize) + 1.0F) * var26 + 1.0D;
int tMinX = MathHelper.floor_double(var20 - var28 / 2.0D);
int tMinY = MathHelper.floor_double(var22 - var30 / 2.0D);
int tMinZ = MathHelper.floor_double(var24 - var28 / 2.0D);
int tMaxX = MathHelper.floor_double(var20 + var28 / 2.0D);
int tMaxY = MathHelper.floor_double(var22 + var30 / 2.0D);
int tMaxZ = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int eX = tMinX; eX <= tMaxX; eX++)
{
double var39 = (eX + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D) {
for (int eY = tMinY; eY <= tMaxY; eY++)
{
double var42 = (eY + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D) {
for (int eZ = tMinZ; eZ <= tMaxZ; eZ++)
{
double var45 = (eZ + 0.5D - var24) / (var28 / 2.0D);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D)
{
Block tTargetedBlock = aWorld.getBlock(eX, eY, eZ);
if (tTargetedBlock == CS.BlocksGT.ore)//GregTech_API.sBlockOres1)
{
TileEntity tTileEntity = aWorld.getTileEntity(eX, eY, eZ);
if ((tTileEntity instanceof PrefixBlockTileEntity)) {
((PrefixBlockTileEntity)tTileEntity).mMetaData = (byte)this.mBlockMeta;
}
}
else if (((this.mAllowToGenerateinVoid) && (aWorld.getBlock(eX, eY, eZ).isAir(aWorld, eX, eY, eZ))) || ((tTargetedBlock != null) && ((tTargetedBlock.isReplaceableOreGen(aWorld, eX, eY, eZ, Blocks.stone)) || (tTargetedBlock.isReplaceableOreGen(aWorld, eX, eY, eZ, Blocks.end_stone)) || (tTargetedBlock.isReplaceableOreGen(aWorld, eX, eY, eZ, Blocks.netherrack)))))
{
aWorld.setBlock(eX, eY, eZ, this.mBlock, this.mBlockMeta, 0);
}
}
}
}
}
}
}
}
}
}
return true;
}
return false;
}
}