Fix
This commit is contained in:
parent
acb20c67e2
commit
b312e8dff8
4 changed files with 75 additions and 57 deletions
|
@ -35,7 +35,8 @@ public final class EntitySphereGen extends Entity
|
|||
private final int STATE_SAVING = 0;
|
||||
private final int STATE_SETUP = 1;
|
||||
private final int STATE_STOP = 2;
|
||||
private int state = STATE_SAVING;
|
||||
private final int STATE_DELETE = 3;
|
||||
private int state = STATE_DELETE;
|
||||
|
||||
private int currentIndex = 0;
|
||||
|
||||
|
@ -44,6 +45,7 @@ public final class EntitySphereGen extends Entity
|
|||
public EntitySphereGen(World world)
|
||||
{
|
||||
super(world);
|
||||
System.out.println("ZLO EntitySphereGen THE FUCK create");
|
||||
}
|
||||
|
||||
public EntitySphereGen(World world, int x, int y, int z, int radius, int blockID, int blockMeta, boolean hollow, boolean fillingSphere)
|
||||
|
@ -56,7 +58,6 @@ public final class EntitySphereGen extends Entity
|
|||
this.zCoord = z;
|
||||
this.posZ = (double) z;
|
||||
this.radius = radius;
|
||||
this.block = new int[] {blockID, blockMeta};
|
||||
this.hollow = hollow;
|
||||
this.fillingSphere = fillingSphere;
|
||||
this.surfaceSphere = (blockID == 0);
|
||||
|
@ -65,7 +66,7 @@ public final class EntitySphereGen extends Entity
|
|||
if (surfaceSphere)
|
||||
defaultBlock = WarpDriveConfig.i.getDefaultSurfaceBlock(world.rand, world.rand.nextInt(10) > 8, true);
|
||||
else
|
||||
defaultBlock = new int[] {blockID, blockMeta};
|
||||
this.block = new int[] {blockID, blockMeta};
|
||||
}
|
||||
|
||||
public void killEntity()
|
||||
|
@ -89,17 +90,16 @@ public final class EntitySphereGen extends Entity
|
|||
saveSphereBlocks();
|
||||
this.state = STATE_SETUP;
|
||||
break;
|
||||
|
||||
case STATE_SETUP:
|
||||
if (currentIndex >= blocks.size() - 1)
|
||||
{
|
||||
currentIndex = 0;
|
||||
killEntity();
|
||||
}
|
||||
this.state = STATE_DELETE;
|
||||
else
|
||||
{
|
||||
setupBlocksTick();
|
||||
}
|
||||
break;
|
||||
case STATE_DELETE:
|
||||
currentIndex = 0;
|
||||
killEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,7 @@ public final class EntitySphereGen extends Entity
|
|||
for (int index = 0; index < blocksToMove; index++)
|
||||
{
|
||||
if (currentIndex >= blocks.size())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
notifyFlag = (currentIndex % 1000 == 0 ? 2 : 0);
|
||||
JumpBlock jb = blocks.get(currentIndex);
|
||||
mySetBlock(worldObj, jb.x, jb.y, jb.z, jb.blockID, jb.blockMeta, notifyFlag);
|
||||
|
@ -196,7 +193,7 @@ public final class EntitySphereGen extends Entity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound)
|
||||
protected void readEntityFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -206,7 +203,7 @@ public final class EntitySphereGen extends Entity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound var1)
|
||||
protected void writeEntityToNBT(NBTTagCompound tag)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -122,11 +122,11 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
world.setBlock(x, y + MOON_RADIUS / 2, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y - MOON_RADIUS / 2, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x + MOON_RADIUS - 10, y, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x - MOON_RADIUS - 10, y, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x - MOON_RADIUS + 10, y, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y, z + MOON_RADIUS - 10, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y, z - MOON_RADIUS - 10, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y, z - MOON_RADIUS + 10, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y + MOON_RADIUS - 10, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y - MOON_RADIUS - 10, z, Block.bedrock.blockID, 0, 0);
|
||||
world.setBlock(x, y - MOON_RADIUS + 10, z, Block.bedrock.blockID, 0, 0);
|
||||
}
|
||||
|
||||
private void placeStarCore(World world, int x, int y, int z, int radius)
|
||||
|
@ -200,9 +200,16 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
{
|
||||
if (world.rand.nextInt(30) == 1)
|
||||
{
|
||||
int[] t = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, 0, 0, false);
|
||||
while(t[0] == 0)
|
||||
t = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, 0, 0, false);
|
||||
int[] t = new int[] {0, 0};
|
||||
if (world.rand.nextInt(25) == 1)
|
||||
while(t[0] == 0)
|
||||
t = WarpDriveConfig.i.getRandomNetherBlock(world.rand, 0, 0);
|
||||
else if (world.rand.nextInt(50) == 1)
|
||||
while(t[0] == 0)
|
||||
t = WarpDriveConfig.i.getRandomEndBlock(world.rand, 0, 0);
|
||||
else
|
||||
while(t[0] == 0)
|
||||
t = WarpDriveConfig.i.getRandomOverworldBlock(world.rand, 0, 0);
|
||||
generateAsteroidOfBlock(world, x, y, z, asteroidSizeMax, centerRadiusMax, t[0], t[1]);
|
||||
}
|
||||
else
|
||||
|
@ -307,7 +314,8 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
centerRadius = Math.min(centerRadiusMax, centerRadius);
|
||||
final int CENTER_SHIFT = 2; // Offset from center of central ball
|
||||
// Asteroid's center
|
||||
generateSphere2(world, x, y, z, centerRadius, true, blockID, meta, false);
|
||||
int[] t = WarpDriveConfig.i.getDefaultSurfaceBlock(world.rand, true, false);
|
||||
generateSphere2(world, x, y, z, centerRadius, true, blockID, meta, false, t);
|
||||
// Asteroids knolls
|
||||
for (int i = 1; i <= asteroidSize; i++)
|
||||
{
|
||||
|
@ -315,7 +323,7 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
int newX = x + (((world.rand.nextBoolean()) ? -1 : 1) * world.rand.nextInt(CENTER_SHIFT + centerRadius / 2));
|
||||
int newY = y + (((world.rand.nextBoolean()) ? -1 : 1) * world.rand.nextInt(CENTER_SHIFT + centerRadius / 2));
|
||||
int newZ = z + (((world.rand.nextBoolean()) ? -1 : 1) * world.rand.nextInt(CENTER_SHIFT + centerRadius / 2));
|
||||
generateSphere2(world, newX, newY, newZ, radius, true, blockID, meta, false);
|
||||
generateSphere2(world, newX, newY, newZ, radius, true, blockID, meta, false, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,14 +345,15 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
if (centerRadiusMax != 0)
|
||||
centerRadius = Math.min(centerRadiusMax, centerRadius);
|
||||
final int CENTER_SHIFT = 2;
|
||||
generateSphere2(world, x, y, z, centerRadius, true, -1, 0, false);
|
||||
int[] t = WarpDriveConfig.i.getDefaultSurfaceBlock(world.rand, true, false);
|
||||
generateSphere2(world, x, y, z, centerRadius, true, -1, 0, false, t);
|
||||
for (int i = 1; i <= asteroidSize; i++)
|
||||
{
|
||||
int radius = 2 + world.rand.nextInt(centerRadius);
|
||||
int newX = x + (((world.rand.nextBoolean()) ? -1 : 1) * world.rand.nextInt(CENTER_SHIFT + centerRadius / 2));
|
||||
int newY = y + (((world.rand.nextBoolean()) ? -1 : 1) * world.rand.nextInt(CENTER_SHIFT + centerRadius / 2));
|
||||
int newZ = z + (((world.rand.nextBoolean()) ? -1 : 1) * world.rand.nextInt(CENTER_SHIFT + centerRadius / 2));
|
||||
generateSphere2(world, newX, newY, newZ, radius, true, -1, 0, false);
|
||||
generateSphere2(world, newX, newY, newZ, radius, true, -1, 0, false, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,6 +369,14 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
* @return
|
||||
*/
|
||||
public void generateSphere2(World world, int xCoord, int yCoord, int zCoord, double radius, boolean corrupted, int forcedID, int meta, boolean hollow)
|
||||
{
|
||||
if (forcedID == -1)
|
||||
generateSphere2(world, xCoord, yCoord, zCoord, radius, corrupted, forcedID, meta, hollow, WarpDriveConfig.i.getDefaultSurfaceBlock(world.rand, corrupted, false));
|
||||
else
|
||||
generateSphere2(world, xCoord, yCoord, zCoord, radius, corrupted, forcedID, meta, hollow, new int[] {forcedID, meta});
|
||||
}
|
||||
|
||||
public void generateSphere2(World world, int xCoord, int yCoord, int zCoord, double radius, boolean corrupted, int forcedID, int meta, boolean hollow, int[] defaultBlock)
|
||||
{
|
||||
radius += 0.5D; // Radius from center of block
|
||||
double radiusSq = radius * radius; // Optimization to avoid sqrts...
|
||||
|
@ -370,13 +387,9 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
if (forcedID == 0)
|
||||
blockID = new int[] {0, 0};
|
||||
else if (forcedID == -1)
|
||||
{
|
||||
blockID = WarpDriveConfig.i.getDefaultSurfaceBlock(world.rand, corrupted, false);
|
||||
forcedID = blockID[0];
|
||||
meta = blockID[1];
|
||||
}
|
||||
else // STUPID JAVA variable blockID might not have been initialized BLA BLA BLA
|
||||
blockID = WarpDriveConfig.i.getDefaultSurfaceBlock(world.rand, corrupted, false);
|
||||
blockID = new int[] {forcedID, meta};//SRANYA JABA might not have been initialized
|
||||
else
|
||||
blockID = new int[] {forcedID, meta};
|
||||
// Pass the cube and check points for sphere equation x^2 + y^2 + z^2 = r^2
|
||||
for (int x = 0; x <= ceilRadius; x++)
|
||||
for (int y = 0; y <= ceilRadius; y++)
|
||||
|
@ -395,29 +408,29 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
// Place blocks
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
if (forcedID > 0)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, forcedID, meta, false);
|
||||
if (forcedID == -1)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, defaultBlock[0], defaultBlock[1], false);
|
||||
world.setBlock(xCoord + x, yCoord + y, zCoord + z, blockID[0], blockID[1], 2);
|
||||
world.setBlock(xCoord - x, yCoord + y, zCoord + z, blockID[0], blockID[1], 2);
|
||||
}
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
if (forcedID > 0)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, forcedID, meta, false);
|
||||
if (forcedID == -1)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, defaultBlock[0], defaultBlock[1], false);
|
||||
world.setBlock(xCoord + x, yCoord - y, zCoord + z, blockID[0], blockID[1], 2);
|
||||
world.setBlock(xCoord + x, yCoord + y, zCoord - z, blockID[0], blockID[1], 2);
|
||||
}
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
if (forcedID > 0)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, forcedID, meta, false);
|
||||
if (forcedID == -1)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, defaultBlock[0], defaultBlock[1], false);
|
||||
world.setBlock(xCoord - x, yCoord - y, zCoord + z, blockID[0], blockID[1], 2);
|
||||
world.setBlock(xCoord + x, yCoord - y, zCoord - z, blockID[0], blockID[1], 2);
|
||||
}
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
if (forcedID > 0)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, forcedID, meta, false);
|
||||
if (forcedID == -1)
|
||||
blockID = WarpDriveConfig.i.getRandomSurfaceBlock(world.rand, defaultBlock[0], defaultBlock[1], false);
|
||||
world.setBlock(xCoord - x, yCoord + y, zCoord - z, blockID[0], blockID[1], 2);
|
||||
world.setBlock(xCoord - x, yCoord - y, zCoord - z, blockID[0], blockID[1], 2);
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ public class WarpDrive implements LoadingCallback
|
|||
@Init
|
||||
public void load(FMLInitializationEvent event)
|
||||
{
|
||||
WarpDriveConfig.i.Init2();
|
||||
// WARP CORE
|
||||
this.warpCore = new BlockReactor(WarpDriveConfig.i.coreID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
|
|
|
@ -86,10 +86,9 @@ public class WarpDriveConfig
|
|||
if (i == null)
|
||||
i = new WarpDriveConfig();
|
||||
i.config = config;
|
||||
i.Init2();
|
||||
}
|
||||
|
||||
private void Init2()
|
||||
public void Init2()
|
||||
{
|
||||
CommonWorldGenOres = new ArrayList<int[]>();
|
||||
CommonWorldGenOres.add(new int[] {Block.oreIron.blockID, 0});
|
||||
|
@ -187,6 +186,7 @@ public class WarpDriveConfig
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading CC classes AWWW SHEEEEET NIGGA");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,15 +194,17 @@ public class WarpDriveConfig
|
|||
{
|
||||
try
|
||||
{
|
||||
Class<?> z = Class.forName("gregtechmod.api.GregTech_API");
|
||||
GT_Machine = ((int[])z.getField("sBlockIDs").get(null))[1];
|
||||
GT_Ores = ((int[])z.getField("sBlockIDs").get(null))[2]; // meta 1-15 = ores
|
||||
GT_Granite = ((int[])z.getField("sBlockIDs").get(null))[5]; // 0 - black, 1 - black cobble, 8 - red, 9 - red cobble
|
||||
Class<?> z = Class.forName("gregtechmod.GT_Mod");
|
||||
int[] t = (int[])z.getField("sBlockIDs").get(null);
|
||||
GT_Machine = t[1];
|
||||
GT_Ores = t[2]; // meta 1-15 = ores
|
||||
GT_Granite = t[5]; // 0 - black, 1 - black cobble, 8 - red, 9 - red cobble
|
||||
MinerOres.add(GT_Ores);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading GT classes");
|
||||
e.printStackTrace();
|
||||
isGregLoaded = false;
|
||||
}
|
||||
}
|
||||
|
@ -219,6 +221,7 @@ public class WarpDriveConfig
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading AE classes");
|
||||
e.printStackTrace();
|
||||
isAELoaded = false;
|
||||
}
|
||||
}
|
||||
|
@ -236,6 +239,7 @@ public class WarpDriveConfig
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading ASP classes");
|
||||
e.printStackTrace();
|
||||
isAdvSolPanelLoaded = false;
|
||||
}
|
||||
}
|
||||
|
@ -268,6 +272,7 @@ public class WarpDriveConfig
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading ICBM classes");
|
||||
e.printStackTrace();
|
||||
isICBMLoaded = false;
|
||||
}
|
||||
}
|
||||
|
@ -282,6 +287,7 @@ public class WarpDriveConfig
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading MFFS classes");
|
||||
e.printStackTrace();
|
||||
isICBMLoaded = false;
|
||||
}
|
||||
}
|
||||
|
@ -296,6 +302,7 @@ public class WarpDriveConfig
|
|||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading GS classes");
|
||||
e.printStackTrace();
|
||||
isGraviSuiteLoaded = false;
|
||||
}
|
||||
}
|
||||
|
@ -316,14 +323,14 @@ public class WarpDriveConfig
|
|||
}
|
||||
else
|
||||
{
|
||||
if (random.nextInt(50) == 1)
|
||||
if (random.nextInt(25) == 1)
|
||||
if (random.nextBoolean())
|
||||
return new int[] {GT_Granite, (corrupted && random.nextBoolean())?1:0};
|
||||
else
|
||||
return new int[] {GT_Granite, (corrupted && random.nextBoolean())?9:8};
|
||||
else if (random.nextInt(100) == 1)
|
||||
else if (random.nextInt(50) == 1)
|
||||
return new int[] {Block.netherrack.blockID, 0};
|
||||
else if (random.nextInt(300) == 1)
|
||||
else if (random.nextInt(150) == 1)
|
||||
return new int[] {Block.whiteStone.blockID, 0};
|
||||
}
|
||||
if (corrupted && random.nextBoolean())
|
||||
|
@ -363,7 +370,7 @@ public class WarpDriveConfig
|
|||
return getRandomOverworldBlock(random, blockID, blockMeta);
|
||||
}
|
||||
|
||||
private int[] getRandomOverworldBlock(Random random, int blockID, int blockMeta)
|
||||
public int[] getRandomOverworldBlock(Random random, int blockID, int blockMeta)
|
||||
{
|
||||
if (random.nextInt(25) == 5)
|
||||
return CommonWorldGenOres.get(random.nextInt(CommonWorldGenOres.size()));
|
||||
|
@ -397,12 +404,12 @@ public class WarpDriveConfig
|
|||
return new int[] {blockID, blockMeta};
|
||||
}
|
||||
|
||||
private int[] getRandomNetherBlock(Random random, int blockID, int blockMeta)
|
||||
public int[] getRandomNetherBlock(Random random, int blockID, int blockMeta)
|
||||
{
|
||||
if (random.nextInt(500) == 1)
|
||||
return new int[] {Block.oreNetherQuartz.blockID, 0};
|
||||
else if (random.nextInt(10000) == 42)
|
||||
if (random.nextInt(10000) == 42)
|
||||
return new int[] {iridiumID, 0};
|
||||
else if (random.nextInt(50) == 1)
|
||||
return new int[] {Block.oreNetherQuartz.blockID, 0};
|
||||
else if (isGregLoaded)
|
||||
{
|
||||
if (random.nextInt(100) == 1)
|
||||
|
@ -412,12 +419,12 @@ public class WarpDriveConfig
|
|||
else if (random.nextInt(500) == 1)
|
||||
return new int[] {GT_Ores, 7}; //Cinnabar I+S
|
||||
}
|
||||
if (random.nextInt(100) == 13)
|
||||
else if (random.nextInt(100) == 13)
|
||||
return CommonWorldGenOres.get(random.nextInt(CommonWorldGenOres.size()));
|
||||
return new int[] {blockID, blockMeta};
|
||||
}
|
||||
|
||||
private int[] getRandomEndBlock(Random random, int blockID, int blockMeta)
|
||||
public int[] getRandomEndBlock(Random random, int blockID, int blockMeta)
|
||||
{
|
||||
if (random.nextInt(10000) == 42)
|
||||
return new int[] {iridiumID, 0};
|
||||
|
@ -432,7 +439,7 @@ public class WarpDriveConfig
|
|||
else if (random.nextInt(1000) == 1)
|
||||
return new int[] {GT_Ores, 11}; //Olivine D+S
|
||||
}
|
||||
if (random.nextInt(200) == 13)
|
||||
else if (random.nextInt(200) == 13)
|
||||
return CommonWorldGenOres.get(random.nextInt(CommonWorldGenOres.size()));
|
||||
return new int[] {blockID, blockMeta};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue