From 8c654aa395306597d31c4810bde1eff80bf5c683 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Mon, 10 Aug 2015 12:29:40 +0200 Subject: [PATCH] Fixed mods integration in recipes & derelicts Fixed #43 ? --- .../cr0s/warpdrive/SpaceEventHandler.java | 8 +- src/main/java/cr0s/warpdrive/WarpDrive.java | 302 ++++++++++++------ .../cr0s/warpdrive/block/BlockDecorative.java | 4 +- .../cr0s/warpdrive/conf/WarpDriveConfig.java | 126 +++++--- .../warpdrive/item/ItemWarpComponent.java | 30 +- .../cr0s/warpdrive/item/ItemWarpUpgrade.java | 12 +- .../machines/TileEntityLaserTreeFarm.java | 2 +- .../cr0s/warpdrive/machines/WarpEnergyTE.java | 6 +- .../warpdrive/machines/WarpInterfacedTE.java | 4 +- .../warpdrive/world/WorldGenSmallShip.java | 81 +++-- .../warpdrive/world/WorldGenStructure.java | 8 +- 11 files changed, 374 insertions(+), 209 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/SpaceEventHandler.java b/src/main/java/cr0s/warpdrive/SpaceEventHandler.java index 9d79c71b..65a15a17 100644 --- a/src/main/java/cr0s/warpdrive/SpaceEventHandler.java +++ b/src/main/java/cr0s/warpdrive/SpaceEventHandler.java @@ -205,15 +205,15 @@ public class SpaceEventHandler { private static boolean consumeO2(ItemStack[] inventory, EntityPlayerMP entityPlayer) { for (int j = 0; j < inventory.length; ++j) { - if (inventory[j] != null && inventory[j] == WarpDriveConfig.IC2_Air) { + if (inventory[j] != null && inventory[j] == WarpDriveConfig.IC2_air) { inventory[j].stackSize--; if (inventory[j].stackSize <= 0) { inventory[j] = null; } - if (WarpDriveConfig.IC2_Empty != null) { + if (WarpDriveConfig.IC2_empty != null) { // WarpDrive.debugPrint("giveEmptyCell"); - ItemStack emptyCell = new ItemStack(WarpDriveConfig.IC2_Empty.getItem(), 1, 0); + ItemStack emptyCell = new ItemStack(WarpDriveConfig.IC2_empty.getItem(), 1, 0); if (!entityPlayer.inventory.addItemStackToInventory(emptyCell)) { World world = entityPlayer.worldObj; EntityItem itemEnt = new EntityItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, emptyCell); @@ -236,7 +236,7 @@ public class SpaceEventHandler { int check = MathHelper.ceiling_float_int(distance - 3.0F); if (check > 0) { - if ( (player.getCurrentArmor(0) != null && player.getCurrentArmor(0) == WarpDriveConfig.getIC2Item("quantumBoots")) // FIXME cache the value + if ( (player.getCurrentArmor(0) != null && player.getCurrentArmor(0) == WarpDriveConfig.getIC2Item("itemArmorQuantumBoots")) // FIXME cache the value || (player.getCurrentArmor(2) != null && WarpDriveConfig.jetpacks.contains(player.getCurrentArmor(2)))) { event.setCanceled(true); // Don't damage player } diff --git a/src/main/java/cr0s/warpdrive/WarpDrive.java b/src/main/java/cr0s/warpdrive/WarpDrive.java index f42c4e83..279ed348 100644 --- a/src/main/java/cr0s/warpdrive/WarpDrive.java +++ b/src/main/java/cr0s/warpdrive/WarpDrive.java @@ -158,9 +158,9 @@ public class WarpDrive implements LoadingCallback { public static ItemWarpAirCanister airCanisterItem; public static BiomeGenBase spaceBiome; - public World space; public SpaceWorldGenerator spaceWorldGenerator; public HyperSpaceWorldGenerator hyperSpaceWorldGenerator; + public World space; public World hyperSpace; // Client settings @@ -338,7 +338,7 @@ public class WarpDrive implements LoadingCallback { GameRegistry.registerTileEntity(TileEntityTransporter.class, "transporter"); // REACTOR MONITOR - if (WarpDriveConfig.isICLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { reactorMonitorBlock = new BlockLaserReactorMonitor(Material.rock); GameRegistry.registerBlock(reactorMonitorBlock, "reactorMonitor"); @@ -373,7 +373,7 @@ public class WarpDrive implements LoadingCallback { GameRegistry.registerBlock(decorativeBlock, ItemBlockDecorative.class, "decorative"); // REACTOR LASER FOCUS - if (WarpDriveConfig.isICLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { reactorLaserFocusItem = new ItemReactorLaserFocus(); GameRegistry.registerItem(reactorLaserFocusItem, "reactorLaserFocus"); } @@ -409,7 +409,7 @@ public class WarpDrive implements LoadingCallback { MinecraftForge.EVENT_BUS.register(new CameraOverlay(Minecraft.getMinecraft())); } - if (WarpDriveConfig.isCCLoaded) { + if (WarpDriveConfig.isComputerCraftLoaded) { peripheralHandler = new WarpDrivePeripheralHandler(); peripheralHandler.register(); } @@ -422,7 +422,7 @@ public class WarpDrive implements LoadingCallback { WarpDriveConfig.postInit(); - if (WarpDriveConfig.isICLoaded && WarpDriveConfig.G_ENABLE_IC2_RECIPES) { + if (WarpDriveConfig.isIndustrialCraft2loaded && WarpDriveConfig.G_ENABLE_IC2_RECIPES) { initIC2Recipes(); } if (WarpDriveConfig.G_ENABLE_VANILLA_RECIPES) { @@ -440,156 +440,280 @@ public class WarpDrive implements LoadingCallback { upgradeItem.initRecipes(); // WarpCore - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(warpCore), false, "ipi", "ici", "idi", 'i', Items.iron_ingot, 'p', componentItem.getIS(6), - 'c', componentItem.getIS(2), 'd', Items.diamond)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(warpCore), false, "ipi", "ici", "idi", + 'i', Items.iron_ingot, + 'p', componentItem.getItemStack(6), + 'c', componentItem.getItemStack(2), + 'd', Items.diamond)); // Controller - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii", 'i', Items.iron_ingot, 'c', - componentItem.getIS(5), 'd', Items.diamond)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii", + 'i', Items.iron_ingot, + 'c', componentItem.getItemStack(5), + 'd', Items.diamond)); // Radar - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii", 'i', Items.iron_ingot, 'c', componentItem.getIS(5), - 'p', componentItem.getIS(6), 'g', Blocks.glass, 'd', Items.diamond)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii", + 'i', Items.iron_ingot, + 'c', componentItem.getItemStack(5), + 'p', componentItem.getItemStack(6), + 'g', Blocks.glass, + 'd', Items.diamond)); // Isolation Block - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi", 'i', Items.iron_ingot, 'g', Blocks.glass, 'e', - Items.ender_pearl)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi", + 'i', Items.iron_ingot, + 'g', Blocks.glass, + 'e', Items.ender_pearl)); // Air generator - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi", 'i', Items.iron_ingot, 'b', Blocks.iron_bars, 'p', - componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi", + 'i', Items.iron_ingot, + 'b', Blocks.iron_bars, + 'p', componentItem.getItemStack(6))); // Laser - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici", 'i', Items.iron_ingot, 'r', Items.redstone, 'c', - componentItem.getIS(5), 'l', componentItem.getIS(3), 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici", + 'i', Items.iron_ingot, + 'r', Items.redstone, + 'c', componentItem.getItemStack(5), + 'l', componentItem.getItemStack(3), + 'p', componentItem.getItemStack(6))); // Mining laser - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili", 'i', Items.iron_ingot, 'r', Items.redstone, - 't', componentItem.getIS(1), 'c', componentItem.getIS(5), 'l', componentItem.getIS(3))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili", + 'i', Items.iron_ingot, + 'r', Items.redstone, + 't', componentItem.getItemStack(1), + 'c', componentItem.getItemStack(5), + 'l', componentItem.getItemStack(3))); // Tree farm laser - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, "ili", "sts", "ici", 'i', Items.iron_ingot, 's', "treeSapling", - 't', componentItem.getIS(1), 'c', componentItem.getIS(5), 'l', componentItem.getIS(3))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, "ili", "sts", "ici", + 'i', Items.iron_ingot, + 's', "treeSapling", + 't', componentItem.getItemStack(1), + 'c', componentItem.getItemStack(5), + 'l', componentItem.getItemStack(3))); // Laser Lift - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili", 'i', Items.iron_ingot, 'r', Items.redstone, 't', - componentItem.getIS(1), 'l', componentItem.getIS(3), 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili", + 'i', Items.iron_ingot, + 'r', Items.redstone, + 't', componentItem.getItemStack(1), + 'l', componentItem.getItemStack(3), + 'p', componentItem.getItemStack(6))); // Transporter - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, "iii", "ptc", "iii", 'i', Items.iron_ingot, 't', componentItem - .getIS(1), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, "iii", "ptc", "iii", + 'i', Items.iron_ingot, + 't', componentItem.getItemStack(1), + 'c', componentItem.getItemStack(5), + 'p', componentItem.getItemStack(6))); // Particle Booster - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii", 'i', Items.iron_ingot, 'r', Items.redstone, 'g', - Blocks.glass, 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii", + 'i', Items.iron_ingot, + 'r', Items.redstone, + 'g', Blocks.glass, + 'p', componentItem.getItemStack(6))); // Camera - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici", 'i', Items.iron_ingot, 'n', Items.gold_nugget, 'g', - Blocks.glass, 'c', componentItem.getIS(5))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici", + 'i', Items.iron_ingot, + 'n', Items.gold_nugget, + 'g', Blocks.glass, + 'c', componentItem.getItemStack(5))); // LaserCamera GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(laserCamBlock), cameraBlock, laserBlock)); // Monitor - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici", 'i', Items.iron_ingot, 't', Blocks.torch, 'g', - Blocks.glass, 'c', componentItem.getIS(5))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici", + 'i', Items.iron_ingot, + 't', Blocks.torch, + 'g', Blocks.glass, + 'c', componentItem.getItemStack(5))); // Cloaking device - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici", 'i', Items.iron_ingot, 'r', Items.redstone, 'l', - componentItem.getIS(3), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici", + 'i', Items.iron_ingot, + 'r', Items.redstone, + 'l', componentItem.getItemStack(3), + 'c', componentItem.getItemStack(5), + 'p', componentItem.getItemStack(6))); // Cloaking coil - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini", 'i', Items.iron_ingot, 'd', Items.diamond, 'r', - Items.redstone, 'n', Items.gold_nugget)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini", + 'i', Items.iron_ingot, + 'd', Items.diamond, + 'r', Items.redstone, + 'n', Items.gold_nugget)); // Power Laser - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerLaserBlock), false, "iii", "ilg", "ici", 'i', Items.iron_ingot, 'g', Blocks.glass, 'c', - componentItem.getIS(5), 'l', componentItem.getIS(3))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerLaserBlock), false, "iii", "ilg", "ici", + 'i', Items.iron_ingot, + 'g', Blocks.glass, + 'c', componentItem.getItemStack(5), + 'l', componentItem.getItemStack(3))); // Power Reactor - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerReactorBlock), false, "ipi", "gog", "ici", 'i', Items.iron_ingot, 'g', Blocks.glass, 'o', - componentItem.getIS(4), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerReactorBlock), false, "ipi", "gog", "ici", + 'i', Items.iron_ingot, + 'g', Blocks.glass, + 'o', componentItem.getItemStack(4), + 'c', componentItem.getItemStack(5), + 'p', componentItem.getItemStack(6))); // Power Store - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerStoreBlock), false, "ipi", "isi", "ici", 'i', Items.iron_ingot, 's', componentItem - .getIS(7), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerStoreBlock), false, "ipi", "isi", "ici", + 'i', Items.iron_ingot, + 's', componentItem.getItemStack(7), + 'c', componentItem.getItemStack(5), + 'p', componentItem.getItemStack(6))); // Transport Beacon - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transportBeaconBlock), false, " e ", "ldl", " s ", 'e', Items.ender_pearl, 'l', "dyeBlue", - 'd', Items.diamond, 's', Items.stick)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transportBeaconBlock), false, " e ", "ldl", " s ", + 'e', Items.ender_pearl, + 'l', "dyeBlue", + 'd', Items.diamond, + 's', Items.stick)); // Chunk Loader - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(chunkLoaderBlock), false, "ipi", "ici", "ifi", 'i', Items.iron_ingot, 'p', componentItem - .getIS(6), 'c', componentItem.getIS(0), 'f', componentItem.getIS(5))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(chunkLoaderBlock), false, "ipi", "ici", "ifi", + 'i', Items.iron_ingot, + 'p', componentItem .getItemStack(6), + 'c', componentItem.getItemStack(0), + 'f', componentItem.getItemStack(5))); // Helmet - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg", 'i', Items.iron_ingot, 'w', Blocks.wool, 'g', - Blocks.glass, 'c', componentItem.getIS(8))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg", + 'i', Items.iron_ingot, + 'w', Blocks.wool, + 'g', Blocks.glass, + 'c', componentItem.getItemStack(8))); } private static void initIC2Recipes() { - GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm', - WarpDriveConfig.getIC2Item("advancedMachine"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit")); + ItemStack advancedMachine = WarpDriveConfig.getIC2Item("blockMachine").copy(); + advancedMachine.setItemDamage(12); + ItemStack miner = WarpDriveConfig.getIC2Item("blockMachine").copy(); + miner.setItemDamage(7); + ItemStack magnetizer = WarpDriveConfig.getIC2Item("blockMachine").copy(); + magnetizer.setItemDamage(9); + ItemStack fiberGlassCable = WarpDriveConfig.getIC2Item("itemCable").copy(); + fiberGlassCable.setItemDamage(9); + ItemStack circuit = WarpDriveConfig.getIC2Item("itemPartCircuit").copy(); + ItemStack ironPlate = WarpDriveConfig.getIC2Item("itemPlates").copy(); + ironPlate.setItemDamage(4); + ItemStack mfe = WarpDriveConfig.getIC2Item("blockElectric").copy(); + mfe.setItemDamage(1); + + GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium"), + 'm', advancedMachine, + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv")); - GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm', - WarpDriveConfig.getIC2Item("advancedMachine"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit")); + GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium"), + 'm', advancedMachine, + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv")); - GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm', - WarpDriveConfig.getIC2Item("advancedMachine"), 'f', WarpDriveConfig.getIC2Item("frequencyTransmitter")); + GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium"), + 'm', advancedMachine, + 'f', WarpDriveConfig.getIC2Item("itemFreq")); - GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm', - WarpDriveConfig.getIC2Item("advancedMachine"), 'd', Blocks.diamond_block); + GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium"), + 'm', advancedMachine, + 'd', Blocks.diamond_block); - GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll", 'l', Blocks.leaves, 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'c', - WarpDriveConfig.getIC2Item("advancedCircuit")); + GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll", + 'l', Blocks.leaves, + 'm', advancedMachine, + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv")); - GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'a', - WarpDriveConfig.getIC2Item("advancedAlloy"), 's', WarpDriveConfig.getIC2Item("advancedCircuit")); + GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa", + 'm', advancedMachine, + 'a', WarpDriveConfig.getIC2Item("itemPartAlloy"), + 's', WarpDriveConfig.getIC2Item("itemPartCircuitAdv")); - GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc", 'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'a', - WarpDriveConfig.getIC2Item("advancedAlloy"), 'm', WarpDriveConfig.getIC2Item("miner")); + GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc", + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'a', WarpDriveConfig.getIC2Item("itemPartAlloy"), + 'm', miner); - GameRegistry - .addRecipe(new ItemStack(boosterBlock), "afc", "ama", "cfa", 'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'a', - WarpDriveConfig.getIC2Item("advancedAlloy"), 'f', WarpDriveConfig.getIC2Item("glassFiberCableItem"), 'm', - WarpDriveConfig.getIC2Item("mfeUnit")); + GameRegistry.addRecipe(new ItemStack(boosterBlock), "afc", "ama", "cfa", + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'a', WarpDriveConfig.getIC2Item("itemPartAlloy"), + 'f', fiberGlassCable, + 'm', mfe); - GameRegistry.addRecipe(new ItemStack(liftBlock), "aca", "ama", "a#a", 'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'a', - WarpDriveConfig.getIC2Item("advancedAlloy"), 'm', WarpDriveConfig.getIC2Item("magnetizer")); + GameRegistry.addRecipe(new ItemStack(liftBlock), "aca", "ama", "a#a", + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'a', WarpDriveConfig.getIC2Item("itemPartAlloy"), + 'm', magnetizer); - GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii", "iii", 'i', WarpDriveConfig.getIC2Item("iridiumPlate")); + GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii", "iii", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium")); - GameRegistry.addShapelessRecipe(new ItemStack(WarpDriveConfig.getIC2Item("iridiumPlate").getItem(), 9), new ItemStack(iridiumBlock)); + GameRegistry.addShapelessRecipe(new ItemStack(WarpDriveConfig.getIC2Item("itemPartIridium").getItem(), 9), new ItemStack(iridiumBlock)); - GameRegistry.addRecipe(new ItemStack(laserCamBlock), "imi", "cec", "#k#", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm', - WarpDriveConfig.getIC2Item("advancedMachine"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'e', laserBlock, 'k', cameraBlock); + GameRegistry.addRecipe(new ItemStack(laserCamBlock), "imi", "cec", "#k#", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium"), + 'm', advancedMachine, + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'e', laserBlock, + 'k', cameraBlock); - GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'c', - WarpDriveConfig.getIC2Item("advancedCircuit"), 'g', Blocks.glass); + GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc", + 'm', advancedMachine, + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'g', Blocks.glass); - GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'c', - WarpDriveConfig.getIC2Item("advancedCircuit"), 'g', Blocks.glass); + GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg", + 'm', advancedMachine, + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'g', Blocks.glass); - GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'a', - WarpDriveConfig.getIC2Item("advancedAlloy"), 's', WarpDriveConfig.getIC2Item("advancedCircuit"), 'g', Blocks.glass); + GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm", + 'm', advancedMachine, + 'a', WarpDriveConfig.getIC2Item("itemPartAlloy"), + 's', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'g', Blocks.glass); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, new Object[] { "cwc", "wmw", "cwc", 'c', - WarpDriveConfig.getIC2Item("electronicCircuit"), 'w', "logWood", 'm', miningLaserBlock })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, new Object[] { "cwc", "wmw", "cwc", + 'c', circuit, + 'w', "logWood", + 'm', miningLaserBlock })); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, new Object[] { "ece", "imi", "iei", 'e', Items.ender_pearl, 'c', - WarpDriveConfig.getIC2Item("electronicCircuit"), 'i', WarpDriveConfig.getIC2Item("plateiron"), 'm', WarpDriveConfig.getIC2Item("machine") })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, new Object[] { "ece", "imi", "iei", + 'e', Items.ender_pearl, + 'c', circuit, + 'i', ironPlate, + 'm', advancedMachine })); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorLaserFocusItem), false, new Object[] { " p ", "pdp", " p ", 'p', - WarpDriveConfig.getIC2Item("plateiron"), 'd', "gemDiamond" })); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorLaserFocusItem), false, new Object[] { " p ", "pdp", " p ", + 'p', ironPlate, + 'd', "gemDiamond" })); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorMonitorBlock), false, new Object[] { "pdp", "dmd", "pdp", 'p', - WarpDriveConfig.getIC2Item("plateiron"), 'd', "gemDiamond", 'm', WarpDriveConfig.getIC2Item("mfeUnit") })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorMonitorBlock), false, new Object[] { "pdp", "dmd", "pdp", + 'p', ironPlate, + 'd', "gemDiamond", + 'm', mfe })); + } - GameRegistry.addRecipe(new ItemStack(cloakBlock), "imi", "mcm", "imi", 'i', iridiumBlock, 'c', cloakCoilBlock, 'm', - WarpDriveConfig.getIC2Item("advancedMachine")); + GameRegistry.addRecipe(new ItemStack(cloakBlock), "imi", "mcm", "imi", + 'i', iridiumBlock, + 'c', cloakCoilBlock, + 'm', advancedMachine); - GameRegistry.addRecipe(new ItemStack(cloakCoilBlock), "iai", "aca", "iai", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'c', - WarpDriveConfig.getIC2Item("advancedCircuit"), 'a', WarpDriveConfig.getIC2Item("advancedAlloy")); + GameRegistry.addRecipe(new ItemStack(cloakCoilBlock), "iai", "aca", "iai", + 'i', WarpDriveConfig.getIC2Item("itemPartIridium"), + 'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"), + 'a', WarpDriveConfig.getIC2Item("itemPartAlloy")); } private static void registerSpaceDimension() { diff --git a/src/main/java/cr0s/warpdrive/block/BlockDecorative.java b/src/main/java/cr0s/warpdrive/block/BlockDecorative.java index 1927c951..3915e489 100644 --- a/src/main/java/cr0s/warpdrive/block/BlockDecorative.java +++ b/src/main/java/cr0s/warpdrive/block/BlockDecorative.java @@ -79,9 +79,9 @@ public class BlockDecorative extends Block { } public void initRecipes() { - GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(0, 8), false, "sss", "scs", "sss", 's', Blocks.stone, 'c', WarpDrive.componentItem.getIS(0))); + GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(0, 8), false, "sss", "scs", "sss", 's', Blocks.stone, 'c', WarpDrive.componentItem.getItemStack(0))); - GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(2, 8), false, "sss", "scs", "sss", 's', getIS(0), 'c', WarpDrive.componentItem.getIS(5))); + GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(2, 8), false, "sss", "scs", "sss", 's', getIS(0), 'c', WarpDrive.componentItem.getItemStack(5))); } } diff --git a/src/main/java/cr0s/warpdrive/conf/WarpDriveConfig.java b/src/main/java/cr0s/warpdrive/conf/WarpDriveConfig.java index 06f5a77f..ca3f82bf 100644 --- a/src/main/java/cr0s/warpdrive/conf/WarpDriveConfig.java +++ b/src/main/java/cr0s/warpdrive/conf/WarpDriveConfig.java @@ -25,13 +25,13 @@ public class WarpDriveConfig { * The variables which store whether or not individual mods are loaded */ public static boolean isForgeMultipartLoaded = false; - public static boolean isAdvSolPanelLoaded = false; + public static boolean isAdvancedSolarPanelLoaded = false; public static boolean isAtomicScienceLoaded = false; public static boolean isICBMLoaded = false; public static boolean isMFFSLoaded = false; public static boolean isGraviSuiteLoaded = false; - public static boolean isICLoaded = false; - public static boolean isCCLoaded = false; + public static boolean isIndustrialCraft2loaded = false; + public static boolean isComputerCraftLoaded = false; public static boolean isNetherOresLoaded = false; public static boolean isThermalExpansionLoaded = false; public static boolean isAdvancedRepulsionSystemsLoaded = false; @@ -42,9 +42,9 @@ public class WarpDriveConfig { public static Method forgeMultipart_helper_sendDescPacket = null; public static Method forgeMultipart_tileMultipart_onChunkLoad = null; - public static ItemStack IC2_Air; - public static ItemStack IC2_Empty; - public static ItemStack IC2_RubberWood; + public static ItemStack IC2_air; + public static ItemStack IC2_empty; + public static ItemStack IC2_rubberWood; public static ItemStack IC2_Resin; public static Item IC2_fluidCell; public static Block CC_Computer, CC_peripheral, CCT_Turtle, CCT_Upgraded, CCT_Advanced; @@ -441,39 +441,47 @@ public class WarpDriveConfig { loadForgeMultipart(); } - isICLoaded = Loader.isModLoaded("IC2"); - if (isICLoaded) + isIndustrialCraft2loaded = Loader.isModLoaded("IC2"); + if (isIndustrialCraft2loaded) { loadIC2(); + } - isCCLoaded = Loader.isModLoaded("ComputerCraft"); - if (isCCLoaded) + isComputerCraftLoaded = Loader.isModLoaded("ComputerCraft"); + if (isComputerCraftLoaded) { loadCC(); + } - isAdvSolPanelLoaded = Loader.isModLoaded("AdvancedSolarPanel"); - if (isAdvSolPanelLoaded) + isAdvancedSolarPanelLoaded = Loader.isModLoaded("AdvancedSolarPanel"); + if (isAdvancedSolarPanelLoaded) { loadASP(); + } isAtomicScienceLoaded = Loader.isModLoaded("ResonantInduction|Atomic"); - if (isAtomicScienceLoaded) + if (isAtomicScienceLoaded) { loadAtomicScience(); + } isICBMLoaded = Loader.isModLoaded("ICBM|Explosion"); - if (isICBMLoaded) + if (isICBMLoaded) { loadICBM(); + } isMFFSLoaded = Loader.isModLoaded("MFFS"); - if (isMFFSLoaded) + if (isMFFSLoaded) { loadMFFS(); + } isGraviSuiteLoaded = Loader.isModLoaded("GraviSuite"); - if (isGraviSuiteLoaded) + if (isGraviSuiteLoaded) { loadGraviSuite(); + } isNetherOresLoaded = Loader.isModLoaded("NetherOres"); isThermalExpansionLoaded = Loader.isModLoaded("ThermalExpansion"); - if (isThermalExpansionLoaded) + if (isThermalExpansionLoaded) { loadThermalExpansion(); + } isAdvancedRepulsionSystemsLoaded = Loader.isModLoaded("AdvancedRepulsionSystems"); if (isAdvancedRepulsionSystemsLoaded) { @@ -498,16 +506,17 @@ public class WarpDriveConfig { scannerIgnoreBlocks.add(WarpDrive.protocolBlock); scannerIgnoreBlocks.add(WarpDrive.iridiumBlock); - if (isICLoaded) { - scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:mfsUnit")); - scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:mfeUnit")); - scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:cesuUnit")); - scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:batBox")); + if (isIndustrialCraft2loaded) { + // Metadata: 0 Batbox, 1 MFE, 2 MFSU, 3 LV transformer, 4 MV transformer, 5 HV transformer, 6 EV transformer, 7 CESU + scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:blockElectric")); + + // Metadata: 0 Batbox, 1 CESU, 2 MFE, 3 MFSU + scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:blockChargepad")); } if (isICBMLoaded) { scannerIgnoreBlocks.add(Block.getBlockFromName("ICBM:explosive")); } - if (isCCLoaded) { + if (isComputerCraftLoaded) { scannerIgnoreBlocks.add(CC_Computer); scannerIgnoreBlocks.add(CCT_Turtle); scannerIgnoreBlocks.add(CCT_Upgraded); @@ -569,33 +578,46 @@ public class WarpDriveConfig { } private static void loadIC2() { - IC2_solarPanel = getIC2Item("solarPanel"); - spaceHelmets.add(getIC2Item("hazmatHelmet").getItem()); - spaceHelmets.add(getIC2Item("quantumHelmet").getItem()); - jetpacks.add(getIC2Item("jetpack").getItem()); - jetpacks.add(getIC2Item("electricJetpack").getItem()); - IC2_Air = getIC2Item("airCell"); - IC2_Empty = getIC2Item("cell"); - ItemStack rubberWood = getIC2Item("rubberWood"); - IC2_Resin = getIC2Item("resin"); - if (rubberWood != null) { - IC2_RubberWood = rubberWood; + try { + IC2_solarPanel = getIC2Item("blockGenerator"); + IC2_solarPanel.setItemDamage(3); + + spaceHelmets.add(getIC2Item("itemArmorHazmatHelmet").getItem()); + spaceHelmets.add(getIC2Item("itemSolarHelmet").getItem()); + spaceHelmets.add(getIC2Item("itemArmorNanoHelmet").getItem()); + spaceHelmets.add(getIC2Item("itemArmorQuantumHelmet").getItem()); + + jetpacks.add(getIC2Item("itemArmorJetpack").getItem()); + jetpacks.add(getIC2Item("itemArmorJetpackElectric").getItem()); + + IC2_empty = getIC2Item("itemCellEmpty"); + IC2_air = getIC2Item("itemCellEmpty"); + IC2_air.setItemDamage(5); + + ItemStack rubberWood = getIC2Item("blockRubWood"); + IC2_Resin = getIC2Item("itemHarz"); + if (rubberWood != null) { + IC2_rubberWood = rubberWood; + minerOres.add(Block.getBlockFromItem(getIC2Item("rubberWood").getItem())); + } + ItemStack ore = getIC2Item("blockOreUran"); + if (ore != null) + commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); + ore = getIC2Item("blockOreCopper"); + if (ore != null) + commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); + ore = getIC2Item("blockOreTin"); + if (ore != null) + commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); + ore = getIC2Item("blockOreLead"); + if (ore != null) + commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); + + IC2_fluidCell = getIC2Item("itemFluidCell").getItem(); + } catch (Exception exception) { + WarpDrive.logger.error("WarpDriveConfig Error loading IndustrialCraft2 classes"); + exception.printStackTrace(); } - ItemStack ore = getIC2Item("uraniumOre"); - if (ore != null) - commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); - ore = getIC2Item("copperOre"); - if (ore != null) - commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); - ore = getIC2Item("tinOre"); - if (ore != null) - commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); - ore = getIC2Item("leadOre"); - if (ore != null) - commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); - - minerOres.add(Block.getBlockFromItem(getIC2Item("rubberWood").getItem())); - IC2_fluidCell = getIC2Item("FluidCell").getItem(); } private static void loadCC() { @@ -622,7 +644,7 @@ public class WarpDriveConfig { } catch (Exception e) { WarpDrive.logger.error("WarpDriveConfig Error loading ASP classes"); e.printStackTrace(); - isAdvSolPanelLoaded = false; + isAdvancedSolarPanelLoaded = false; } } @@ -750,7 +772,7 @@ public class WarpDriveConfig { } public static Block getRandomNetherBlock(Random random, Block def) { - if (isICLoaded && (random.nextInt(10000) == 42)) { + if (isIndustrialCraft2loaded && (random.nextInt(10000) == 42)) { return WarpDrive.iridiumBlock; } else if (random.nextInt(25) == 1) { return Blocks.quartz_ore; @@ -760,7 +782,7 @@ public class WarpDriveConfig { } public static Block getRandomEndBlock(Random random, Block def) { - if (isICLoaded && random.nextInt(10000) == 42) { + if (isIndustrialCraft2loaded && random.nextInt(10000) == 42) { return WarpDrive.iridiumBlock; } else if (random.nextInt(200) == 13) { return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size())); diff --git a/src/main/java/cr0s/warpdrive/item/ItemWarpComponent.java b/src/main/java/cr0s/warpdrive/item/ItemWarpComponent.java index a3e0ee6f..8ca85f11 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemWarpComponent.java +++ b/src/main/java/cr0s/warpdrive/item/ItemWarpComponent.java @@ -39,7 +39,7 @@ public class ItemWarpComponent extends Item implements IAirCanister { cachedIS = new ItemStack[potentialUnlocalized.length]; } - public ItemStack getIS(int damage) { + public ItemStack getItemStack(int damage) { if (damage >=0 && damage < potentialUnlocalized.length) { if (cachedIS[damage] == null) { cachedIS[damage] = new ItemStack(WarpDrive.componentItem,1,damage); @@ -55,50 +55,50 @@ public class ItemWarpComponent extends Item implements IAirCanister { public void registerRecipes() { WarpDrive.debugPrint("Registering empty recipe"); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(0),false,"nrn","r r","nrn", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(0),false,"nrn","r r","nrn", 'r', Items.redstone, 'n', Items.gold_nugget)); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(1),false,"g","e","c", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(1),false,"g","e","c", 'g', Blocks.glass, 'e', Items.ender_pearl, - 'c', getIS(0))); + 'c', getItemStack(0))); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(2),false," g ","ede"," c ", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(2),false," g ","ede"," c ", 'g', Blocks.glass, 'e', Items.ender_pearl, 'd', Items.diamond, - 'c', getIS(0))); + 'c', getItemStack(0))); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(3),false," g ","rtr"," c ", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(3),false," g ","rtr"," c ", 'g', Blocks.glass, 'r', "dyeBlue", 't', Blocks.torch, - 'c', getIS(0))); + 'c', getItemStack(0))); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(4),false," l ","rcr"," l ", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(4),false," l ","rcr"," l ", 'l', "dyeWhite", 'r', Items.coal, - 'c', getIS(0))); + 'c', getItemStack(0))); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(5),false,"g ","gwr","rwr", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(5),false,"g ","gwr","rwr", 'g', Items.gold_nugget, 'r', Items.redstone, 'w', "plankWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(6),false,"gig","iri","gig", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(6),false,"gig","iri","gig", 'g', Items.gold_nugget, 'r', Items.redstone, 'i', Items.iron_ingot)); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(7),false,"glg","ldl","glg", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(7),false,"glg","ldl","glg", 'g', Items.gold_nugget, 'l', "dyeBlue", 'd', Items.diamond)); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(8),false,"gcg","g g","gcg", + GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(8),false,"gcg","g g","gcg", 'g', Blocks.glass, - 'c', getIS(0))); + 'c', getItemStack(0))); } public boolean doesMatch(ItemStack is, String unlocalised) { diff --git a/src/main/java/cr0s/warpdrive/item/ItemWarpUpgrade.java b/src/main/java/cr0s/warpdrive/item/ItemWarpUpgrade.java index 0f1c72a9..ce249811 100644 --- a/src/main/java/cr0s/warpdrive/item/ItemWarpUpgrade.java +++ b/src/main/java/cr0s/warpdrive/item/ItemWarpUpgrade.java @@ -79,16 +79,16 @@ public class ItemWarpUpgrade extends Item { } public void initRecipes() { - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Energy.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e', - WarpDrive.componentItem.getIS(7), 'r', Items.redstone)); + GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Energy.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e', + WarpDrive.componentItem.getItemStack(7), 'r', Items.redstone)); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Power.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e', - WarpDrive.componentItem.getIS(6), 'r', Items.redstone)); + GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Power.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e', + WarpDrive.componentItem.getItemStack(6), 'r', Items.redstone)); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Speed.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e', + GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Speed.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e', Items.sugar, 'r', Items.redstone)); - GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Range.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e', + GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Range.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e', WarpDrive.transportBeaconBlock, 'r', Items.redstone)); } diff --git a/src/main/java/cr0s/warpdrive/machines/TileEntityLaserTreeFarm.java b/src/main/java/cr0s/warpdrive/machines/TileEntityLaserTreeFarm.java index 19d2fea0..62d5db65 100644 --- a/src/main/java/cr0s/warpdrive/machines/TileEntityLaserTreeFarm.java +++ b/src/main/java/cr0s/warpdrive/machines/TileEntityLaserTreeFarm.java @@ -100,7 +100,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner { int cost = calculateBlockCost(block); if (consumeEnergyFromBooster(cost, true)) { if (isRoomForHarvest()) { - if (block.isAssociatedBlock(Block.getBlockFromItem(WarpDriveConfig.IC2_RubberWood.getItem()))) { + if (block.isAssociatedBlock(Block.getBlockFromItem(WarpDriveConfig.IC2_rubberWood.getItem()))) { int metadata = worldObj.getBlockMetadata(pos.intX(), pos.intY(), pos.intZ()); if (metadata >= 2 && metadata <= 5) { WarpDrive.debugPrint("wetspot found"); diff --git a/src/main/java/cr0s/warpdrive/machines/WarpEnergyTE.java b/src/main/java/cr0s/warpdrive/machines/WarpEnergyTE.java index 7a6fd373..0e5ed347 100644 --- a/src/main/java/cr0s/warpdrive/machines/WarpEnergyTE.java +++ b/src/main/java/cr0s/warpdrive/machines/WarpEnergyTE.java @@ -188,7 +188,7 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa } // IndustrialCraft2 - if (WarpDriveConfig.isICLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { IC2_addToEnergyNet(); } @@ -205,7 +205,7 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa @Override public void onChunkUnload() { - if (WarpDriveConfig.isICLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { IC2_removeFromEnergyNet(); } @@ -214,7 +214,7 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa @Override public void invalidate() { - if (WarpDriveConfig.isICLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { IC2_removeFromEnergyNet(); } diff --git a/src/main/java/cr0s/warpdrive/machines/WarpInterfacedTE.java b/src/main/java/cr0s/warpdrive/machines/WarpInterfacedTE.java index 46c14936..eccf05a2 100644 --- a/src/main/java/cr0s/warpdrive/machines/WarpInterfacedTE.java +++ b/src/main/java/cr0s/warpdrive/machines/WarpInterfacedTE.java @@ -61,7 +61,7 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En super.updateEntity(); if (interfacedFirstTick) { - if (WarpDriveConfig.isCCLoaded) { + if (WarpDriveConfig.isComputerCraftLoaded) { String CC_path = "/assets/" + WarpDrive.MODID.toLowerCase() + "/lua.ComputerCraft/" + peripheralName; CC_hasResource = assetExist(CC_path); } @@ -202,7 +202,7 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En // Computer abstraction methods protected void sendEvent(String eventName, Object[] arguments) { // WarpDrive.debugPrint("" + this + " Sending event '" + eventName + "'"); - if (WarpDriveConfig.isCCLoaded) { + if (WarpDriveConfig.isComputerCraftLoaded) { Set keys = connectedComputers.keySet(); for(Integer key:keys) { IComputerAccess comp = connectedComputers.get(key); diff --git a/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java b/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java index f2180c29..48b5b51d 100644 --- a/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java +++ b/src/main/java/cr0s/warpdrive/world/WorldGenSmallShip.java @@ -21,7 +21,7 @@ public class WorldGenSmallShip extends WorldGenerator { public WorldGenSmallShip(boolean corrupted) { this.corrupted = corrupted; - if (WarpDriveConfig.isICLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { IC2_solarType = WarpDriveConfig.IC2_solarPanel.getItemDamage(); } else { WarpDriveConfig.IC2_solarPanel = new ItemStack(Blocks.air); // FIXME: have proper generation for non-IC2 @@ -32,28 +32,28 @@ public class WorldGenSmallShip extends WorldGenerator { @Override public boolean generate(World world, Random rand, int centerX, int centerY, int centerZ) { ItemStack cableType = new ItemStack(Blocks.air); - if (WarpDriveConfig.isICLoaded) { - if (WarpDriveConfig.isAdvSolPanelLoaded) { + if (WarpDriveConfig.isIndustrialCraft2loaded) { + if (WarpDriveConfig.isAdvancedSolarPanelLoaded) { IC2_solarType = rand.nextInt(2); } - cableType = WarpDriveConfig.getIC2Item("copperCableBlock").copy(); + cableType = WarpDriveConfig.getIC2Item("blockCable").copy(); switch (rand.nextInt(4)) { case 0: - cableType = WarpDriveConfig.getIC2Item("glassFiberCableBlock").copy(); + cableType.setItemDamage(0); break; case 1: - cableType = WarpDriveConfig.getIC2Item("glassFiberCableBlock").copy(); + cableType.setItemDamage(3); break; case 2: - cableType = WarpDriveConfig.getIC2Item("insulatedGoldCableBlock").copy(); + cableType.setItemDamage(6); break; case 3: - cableType = WarpDriveConfig.getIC2Item("doubleInsulatedIronCableBlock").copy(); + cableType.setItemDamage(9); break; } } @@ -227,8 +227,10 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 7, j + 5, k + 12, WorldGenStructure.getGlassBlock(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 + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); - world.setBlock(i + 7, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + 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.IC2_solarPanel.getItem()), IC2_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)); @@ -260,8 +262,10 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 8, j + 5, k + 12, WorldGenStructure.getGlassBlock(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 + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); - world.setBlock(i + 8, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + 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.IC2_solarPanel.getItem()), IC2_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)); @@ -295,8 +299,10 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 9, j + 5, k + 12, WorldGenStructure.getGlassBlock(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 + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); - world.setBlock(i + 9, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + 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.IC2_solarPanel.getItem()), IC2_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)); @@ -335,8 +341,10 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 10, j + 5, k + 12, WorldGenStructure.getGlassBlock(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 + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); - world.setBlock(i + 10, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + 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.IC2_solarPanel.getItem()), IC2_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)); @@ -380,7 +388,7 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 11, j + 4, k + 6, WorldGenStructure.getGlassBlock(corrupted, rand)); // Place computer - if (rand.nextBoolean()) { + if (rand.nextBoolean() && WarpDriveConfig.isComputerCraftLoaded) { world.setBlock(i + 11, j + 4, k + 7, WarpDriveConfig.CC_Computer, 12, 3); } @@ -391,8 +399,10 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 11, j + 5, k + 12, WorldGenStructure.getGlassBlock(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 + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); - world.setBlock(i + 11, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + 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.IC2_solarPanel.getItem()), IC2_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)); @@ -432,16 +442,22 @@ public class WorldGenSmallShip extends WorldGenerator { world.setBlock(i + 12, j + 3, k + 12, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 12, j + 4, k + 2, WorldGenStructure.getGlassBlock(corrupted, rand)); world.setBlock(i + 12, j + 4, k + 6, WorldGenStructure.getGlassBlock(corrupted, rand)); - world.setBlock(i + 12, j + 4, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + world.setBlock(i + 12, j + 4, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + } world.setBlock(i + 12, j + 4, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand)); world.setBlock(i + 12, j + 4, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand)); world.setBlock(i + 12, j + 5, k + 2, WorldGenStructure.getGlassBlock(corrupted, rand)); - world.setBlock(i + 12, j + 5, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + world.setBlock(i + 12, j + 5, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + } world.setBlock(i + 12, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand)); world.setBlock(i + 12, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 12, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand)); - world.setBlock(i + 12, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); - world.setBlock(i + 12, j + 6, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + world.setBlock(i + 12, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + world.setBlock(i + 12, j + 6, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0); + } world.setBlock(i + 12, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 12, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand)); world.setBlock(i + 12, j + 7, k + 5, WorldGenStructure.getStoneBlock(corrupted, rand)); @@ -605,14 +621,15 @@ public class WorldGenSmallShip extends WorldGenerator { while (!isDone) { switch (rand.nextInt(14)) { - case 0: - res = WarpDriveConfig.getIC2Item("massFabricator").copy(); + case 0:// Mass fabricator + res = WarpDriveConfig.getIC2Item("blockMachine").copy(); + res.setItemDamage(14); res.stackSize = 1; // + rand.nextInt(2); isDone = true; break; case 1: - res = WarpDriveConfig.getIC2Item("nuke").copy(); + res = WarpDriveConfig.getIC2Item("blockNuke").copy(); res.stackSize = 1 + rand.nextInt(2); isDone = true; break; @@ -624,14 +641,16 @@ public class WorldGenSmallShip extends WorldGenerator { isDone = true; break;// skipped - case 6: - res = WarpDriveConfig.getIC2Item("glassFiberCableItem").copy(); + case 6:// Glass fiber cable item + res = WarpDriveConfig.getIC2Item("itemCable").copy(); + res.setItemDamage(9); res.stackSize = 2 + rand.nextInt(12); isDone = true; break; - case 7: - res = WarpDriveConfig.getIC2Item("matter").copy(); + case 7:// UU matter cell + res = WarpDriveConfig.getIC2Item("itemCellEmpty").copy(); + res.setItemDamage(3); res.stackSize = 2 + rand.nextInt(14); isDone = true; break; @@ -664,7 +683,7 @@ public class WorldGenSmallShip extends WorldGenerator { // Advanced solar panels case 13: - if (WarpDriveConfig.isAdvSolPanelLoaded) { + if (WarpDriveConfig.isAdvancedSolarPanelLoaded) { res = new ItemStack(WarpDriveConfig.IC2_solarPanel.getItem(), rand.nextInt(3), IC2_solarType).copy(); isDone = true; } diff --git a/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java b/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java index c00e9ec5..0290faad 100644 --- a/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java +++ b/src/main/java/cr0s/warpdrive/world/WorldGenStructure.java @@ -11,8 +11,8 @@ public class WorldGenStructure { if (corrupted && (rand.nextInt(15) == 1)) return Blocks.air; - if (WarpDriveConfig.isICLoaded) { - return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("reinforcedStone").getItem()); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("blockAlloy").getItem()); } else { return Blocks.stone; } @@ -22,8 +22,8 @@ public class WorldGenStructure { if (corrupted && (rand.nextInt(30) == 1)) return Blocks.air; - if (WarpDriveConfig.isICLoaded) { - return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("reinforcedGlass").getItem()); + if (WarpDriveConfig.isIndustrialCraft2loaded) { + return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("blockAlloyGlass").getItem()); } else { return Blocks.glass; }