From 5ebf98008d88769ddbbab729a499b51341e453e8 Mon Sep 17 00:00:00 2001 From: Francesco Macagno Date: Sun, 26 Jul 2015 17:06:52 -0700 Subject: [PATCH] Fixed more world gen to work with new Config --- .../cr0s/warpdrive/world/EntitySphereGen.java | 20 ++++++------- .../warpdrive/world/WorldGenSmallShip.java | 29 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/java/cr0s/warpdrive/world/EntitySphereGen.java b/src/java/cr0s/warpdrive/world/EntitySphereGen.java index b6f7bc60..2facdb98 100644 --- a/src/java/cr0s/warpdrive/world/EntitySphereGen.java +++ b/src/java/cr0s/warpdrive/world/EntitySphereGen.java @@ -152,7 +152,7 @@ public final class EntitySphereGen extends Entity { radius += 0.5D; // Radius from center of block double radiusSq = radius * radius; // Optimization to avoid square roots double radius1Sq = (radius - 1.0D) * (radius - 1.0D); // for hollow - // sphere + // sphere int ceilRadius = (int) Math.ceil(radius); // 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++) { double z2 = (z + 0.5D) * (z + 0.5D); double dSq = x2 + y2 + z2; // Distance from current position - // to center + // to center // Skip too far blocks if (dSq > radiusSq) @@ -177,29 +177,29 @@ public final class EntitySphereGen extends Entity { continue; if (generateOres) - block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, defaultMeta, true); + block = WarpDriveConfig.getRandomSurfaceBlock(worldObj.rand, defaultBlock, true); // Add blocks to memory addBlock(new JumpBlock(block, defaultMeta, xCoord + x, yCoord + y, zCoord + z)); 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)); 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)); 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)); 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)); 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)); 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)); 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)); } } diff --git a/src/java/cr0s/warpdrive/world/WorldGenSmallShip.java b/src/java/cr0s/warpdrive/world/WorldGenSmallShip.java index 6dbb009e..7e9f61f0 100644 --- a/src/java/cr0s/warpdrive/world/WorldGenSmallShip.java +++ b/src/java/cr0s/warpdrive/world/WorldGenSmallShip.java @@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; +import appeng.api.AEApi; import cr0s.warpdrive.WarpDrive; 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 + 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 + 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 + 11, 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 + 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 + 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 + 11, 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 + 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 + 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 world.setBlock(i + 9, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0); 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 + 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 + 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 world.setBlock(i + 10, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0); 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 + 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 + 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 + 11, 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; break;// skipped - // AE Quarz + // AE Quarz case 9: if (WarpDriveConfig.isAppliedEnergisticsLoaded) { - res = WarpDriveConfig.getAEMaterial("matQuartz").copy(); - res.stackSize = 2 + rand.nextInt(22); + res = AEApi.instance().definitions().materials().fluixCrystal().maybeStack(2 + rand.nextInt(22)).get(); isDone = true; } break; - // AE improved processor + // AE improved processor case 10: if (WarpDriveConfig.isAppliedEnergisticsLoaded) { - res = WarpDriveConfig.getAEMaterial("matProcessorAdvanced").copy(); - res.stackSize = 1 + rand.nextInt(3); + res = AEApi.instance().definitions().materials().advCard().maybeStack(res.stackSize = 1 + rand.nextInt(3)).get(); isDone = true; } break; - // Rocket launcher platform Tier3 + // Rocket launcher platform Tier3 case 11: if (WarpDriveConfig.isICBMLoaded) { // TODO: No 1.7 ICBM yet @@ -659,7 +658,7 @@ public class WorldGenSmallShip extends WorldGenerator { } break; - // Missles from conventional to hypersonic + // Missles from conventional to hypersonic case 12: if (WarpDriveConfig.isICBMLoaded) { // TODO: No 1.7 ICBM yet @@ -669,10 +668,10 @@ public class WorldGenSmallShip extends WorldGenerator { } break; - // Advanced solar panels + // Advanced solar panels case 13: 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; } break;