From 2a2d86318f389a649d57aa3d265a3fe396dc08d1 Mon Sep 17 00:00:00 2001 From: LemADEC Date: Mon, 31 Aug 2015 04:45:21 +0200 Subject: [PATCH] Code cleanup --- .../block/TileEntityAbstractEnergy.java | 6 +-- .../collection/TileEntityAbstractMiner.java | 23 +---------- .../java/cr0s/warpdrive/config/Recipes.java | 40 +++++++++---------- 3 files changed, 24 insertions(+), 45 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java index d18bb068..5c804ed4 100644 --- a/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java +++ b/src/main/java/cr0s/warpdrive/block/TileEntityAbstractEnergy.java @@ -125,17 +125,17 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa public boolean consumeEnergy(int amount_internal, boolean simulate) { int amountUpgraded = amount_internal; if (upgrades.containsKey(EnumUpgradeTypes.Power)) { - double valueMul = Math.pow(0.8,upgrades.get(EnumUpgradeTypes.Power)); + double valueMul = Math.pow(0.8, upgrades.get(EnumUpgradeTypes.Power)); amountUpgraded = (int) Math.ceil(valueMul * amountUpgraded); } if (upgrades.containsKey(EnumUpgradeTypes.Range)) { - double valueMul = Math.pow(1.2,upgrades.get(EnumUpgradeTypes.Range)); + double valueMul = Math.pow(1.2, upgrades.get(EnumUpgradeTypes.Range)); amountUpgraded = (int) Math.ceil(valueMul * amountUpgraded); } if (upgrades.containsKey(EnumUpgradeTypes.Speed)) { - double valueMul = Math.pow(1.2,upgrades.get(EnumUpgradeTypes.Speed)); + double valueMul = Math.pow(1.2, upgrades.get(EnumUpgradeTypes.Speed)); amountUpgraded = (int) Math.ceil(valueMul * amountUpgraded); } // FIXME: upgrades balancing & implementation to be done... diff --git a/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java b/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java index 5fee9d4b..c0860f88 100644 --- a/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java +++ b/src/main/java/cr0s/warpdrive/block/collection/TileEntityAbstractMiner.java @@ -172,28 +172,7 @@ public abstract class TileEntityAbstractMiner extends TileEntityAbstractLaser return false; } - private boolean canDig(Block block, int x, int y, int z) {// not used - // ignore air & fluids - if (block == null || (worldObj.isAirBlock(x, y, z) || (block instanceof IFluidBlock))) { - return false; - } - // check blacklist - if (block.isAssociatedBlock(Blocks.bedrock)) { - return false; - } - if (WarpDriveConfig.forceFieldBlocks.contains(block)) { - // isMining = false; - return false; - } - // check whitelist - // WarpDriveConfig.MinerOres.contains(blockID) then true ? - else if (block.isAssociatedBlock(WarpDrive.blockIridium)) { - return true; - } - // check default - else if (block.getExplosionResistance(null) <= Blocks.obsidian.getExplosionResistance(null)) { - return true; - } + private boolean canDig(Block block, int x, int y, int z) {// not used, should be abstract return false; } diff --git a/src/main/java/cr0s/warpdrive/config/Recipes.java b/src/main/java/cr0s/warpdrive/config/Recipes.java index 5f738f83..c05a1616 100644 --- a/src/main/java/cr0s/warpdrive/config/Recipes.java +++ b/src/main/java/cr0s/warpdrive/config/Recipes.java @@ -177,16 +177,16 @@ public class Recipes { } public static void initIC2() { - ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1).copy(); - ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1).copy(); - ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12).copy(); - ItemStack miner = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 7).copy(); - ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9).copy(); - ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9).copy(); - ItemStack circuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuit", -1).copy(); - ItemStack advancedCircuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuitAdv", -1).copy(); - ItemStack ironPlate = WarpDriveConfig.getModItemStack("IC2", "itemPlates", 4).copy(); - ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1).copy(); + ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1); + ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1); + ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12); + ItemStack miner = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 7); + ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9); + ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9); + ItemStack circuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuit", -1); + ItemStack advancedCircuit = WarpDriveConfig.getModItemStack("IC2", "itemPartCircuitAdv", -1); + ItemStack ironPlate = WarpDriveConfig.getModItemStack("IC2", "itemPlates", 4); + ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1); GameRegistry.addRecipe(new ItemStack(WarpDrive.blockShipCore), "ici", "cmc", "ici", 'i', iridiumAlloy, @@ -296,16 +296,16 @@ public class Recipes { } public static void initHardIC2() { - ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1).copy(); - ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1).copy(); - ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12).copy(); - ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9).copy(); - ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9).copy(); - ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1).copy(); - ItemStack mfsu = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 2).copy(); - ItemStack energiumDust = WarpDriveConfig.getModItemStack("IC2", "itemDust2", 2).copy(); - ItemStack crystalmemory = WarpDriveConfig.getModItemStack("IC2", "itemcrystalmemory", -1).copy(); - ItemStack itemHAMachine = new ItemStack(WarpDrive.blockHighlyAdvancedMachine).copy(); + ItemStack advancedAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartAlloy", -1); + ItemStack iridiumAlloy = WarpDriveConfig.getModItemStack("IC2", "itemPartIridium", -1); + ItemStack advancedMachine = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 12); + ItemStack magnetizer = WarpDriveConfig.getModItemStack("IC2", "blockMachine", 9); + ItemStack fiberGlassCable = WarpDriveConfig.getModItemStack("IC2", "itemCable", 9); + ItemStack mfe = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 1); + ItemStack mfsu = WarpDriveConfig.getModItemStack("IC2", "blockElectric", 2); + ItemStack energiumDust = WarpDriveConfig.getModItemStack("IC2", "itemDust2", 2); + ItemStack crystalmemory = WarpDriveConfig.getModItemStack("IC2", "itemcrystalmemory", -1); + ItemStack itemHAMachine = new ItemStack(WarpDrive.blockHighlyAdvancedMachine); GameRegistry.addRecipe(new ItemStack(WarpDrive.blockShipCore),"uau", "tmt", "uau", 'a', advancedAlloy,