Fixed more world gen to work with new Config

This commit is contained in:
Francesco Macagno 2015-07-26 17:06:52 -07:00
parent 5871316b00
commit 5ebf98008d
2 changed files with 24 additions and 25 deletions

View file

@ -152,7 +152,7 @@ public final class EntitySphereGen extends Entity {
radius += 0.5D; // Radius from center of block radius += 0.5D; // Radius from center of block
double radiusSq = radius * radius; // Optimization to avoid square roots double radiusSq = radius * radius; // Optimization to avoid square roots
double radius1Sq = (radius - 1.0D) * (radius - 1.0D); // for hollow double radius1Sq = (radius - 1.0D) * (radius - 1.0D); // for hollow
// sphere // sphere
int ceilRadius = (int) Math.ceil(radius); int ceilRadius = (int) Math.ceil(radius);
// Pass the cube and check points for sphere equation x^2 + y^2 + z^2 = // Pass the cube and check points for sphere equation x^2 + y^2 + z^2 =
@ -165,7 +165,7 @@ public final class EntitySphereGen extends Entity {
for (int z = 0; z <= ceilRadius; z++) { for (int z = 0; z <= ceilRadius; z++) {
double z2 = (z + 0.5D) * (z + 0.5D); double z2 = (z + 0.5D) * (z + 0.5D);
double dSq = x2 + y2 + z2; // Distance from current position double dSq = x2 + y2 + z2; // Distance from current position
// to center // to center
// Skip too far blocks // Skip too far blocks
if (dSq > radiusSq) if (dSq > radiusSq)
@ -177,29 +177,29 @@ public final class EntitySphereGen extends Entity {
continue; continue;
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
// Add blocks to memory // Add blocks to memory
addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord + y, zCoord + z)); addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord + y, zCoord + z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord + y, zCoord + z)); addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord + y, zCoord + z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord - y, zCoord + z)); addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord - y, zCoord + z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord + y, zCoord - z)); addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord + y, zCoord - z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord - y, zCoord + z)); addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord - y, zCoord + z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord - y, zCoord - z)); addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord - y, zCoord - z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord + y, zCoord - z)); addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord + y, zCoord - z));
if (generateOres) if (generateOres)
block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true);
addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord - y, zCoord - z)); addBlock(new JumpBlock(block, defaultMeta, xCoord - x, yCoord - y, zCoord - z));
} }
} }

View file

@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
import appeng.api.AEApi;
import cr0s.warpdrive.WarpDrive; import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.WarpDriveConfig; import cr0s.warpdrive.WarpDriveConfig;
@ -218,7 +219,7 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 7, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 7, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 7, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); world.setBlock(i + 7, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 7, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP), solarType, 0); world.setBlock(i + 7, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP.getItem()), solarType, 0);
world.setBlock(i + 7, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 7, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 7, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 7, k + 5, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 7, j + 7, k + 5, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -251,7 +252,7 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 8, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 8, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 8, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); world.setBlock(i + 8, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 8, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP), solarType, 0); world.setBlock(i + 8, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP.getItem()), solarType, 0);
world.setBlock(i + 8, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 8, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 8, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 8, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -286,7 +287,7 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 9, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 9, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 9, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 9, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 9, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); world.setBlock(i + 9, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 9, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP), solarType, 0); world.setBlock(i + 9, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP.getItem()), solarType, 0);
// Placing air generator // Placing air generator
world.setBlock(i + 9, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0); world.setBlock(i + 9, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0);
world.setBlock(i + 9, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 9, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -326,7 +327,7 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 10, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 10, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 10, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 10, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 10, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); world.setBlock(i + 10, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 10, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP), solarType, 0); world.setBlock(i + 10, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP.getItem()), solarType, 0);
// Placing air generator // Placing air generator
world.setBlock(i + 10, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0); world.setBlock(i + 10, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0);
world.setBlock(i + 10, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 10, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -382,7 +383,7 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 11, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 11, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 11, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); world.setBlock(i + 11, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 11, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP), solarType, 0); world.setBlock(i + 11, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.ASP.getItem()), solarType, 0);
world.setBlock(i + 11, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 11, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 11, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 11, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -630,26 +631,24 @@ public class WorldGenSmallShip extends WorldGenerator {
isDone = true; isDone = true;
break;// skipped break;// skipped
// AE Quarz // AE Quarz
case 9: case 9:
if (WarpDriveConfig.isAppliedEnergisticsLoaded) { if (WarpDriveConfig.isAppliedEnergisticsLoaded) {
res = WarpDriveConfig.getAEMaterial("matQuartz").copy(); res = AEApi.instance().definitions().materials().fluixCrystal().maybeStack(2 + rand.nextInt(22)).get();
res.stackSize = 2 + rand.nextInt(22);
isDone = true; isDone = true;
} }
break; break;
// AE improved processor // AE improved processor
case 10: case 10:
if (WarpDriveConfig.isAppliedEnergisticsLoaded) { if (WarpDriveConfig.isAppliedEnergisticsLoaded) {
res = WarpDriveConfig.getAEMaterial("matProcessorAdvanced").copy(); res = AEApi.instance().definitions().materials().advCard().maybeStack(res.stackSize = 1 + rand.nextInt(3)).get();
res.stackSize = 1 + rand.nextInt(3);
isDone = true; isDone = true;
} }
break; break;
// Rocket launcher platform Tier3 // Rocket launcher platform Tier3
case 11: case 11:
if (WarpDriveConfig.isICBMLoaded) { if (WarpDriveConfig.isICBMLoaded) {
// TODO: No 1.7 ICBM yet // TODO: No 1.7 ICBM yet
@ -659,7 +658,7 @@ public class WorldGenSmallShip extends WorldGenerator {
} }
break; break;
// Missles from conventional to hypersonic // Missles from conventional to hypersonic
case 12: case 12:
if (WarpDriveConfig.isICBMLoaded) { if (WarpDriveConfig.isICBMLoaded) {
// TODO: No 1.7 ICBM yet // TODO: No 1.7 ICBM yet
@ -669,10 +668,10 @@ public class WorldGenSmallShip extends WorldGenerator {
} }
break; break;
// Advanced solar panels // Advanced solar panels
case 13: case 13:
if (WarpDriveConfig.isAdvSolPanelLoaded) { if (WarpDriveConfig.isAdvSolPanelLoaded) {
res = new ItemStack(WarpDriveConfig.ASP, rand.nextInt(3), solarType).copy(); res = new ItemStack(WarpDriveConfig.ASP.getItem(), rand.nextInt(3), solarType).copy();
isDone = true; isDone = true;
} }
break; break;