From c085a1e9a29fd19f358d0a29f8c8f3202eaea555 Mon Sep 17 00:00:00 2001 From: asiekierka Date: Sun, 28 Jun 2015 22:28:47 +0200 Subject: [PATCH] code cleanup --- common/buildcraft/BuildCraftCore.java | 148 +++++++++--------- common/buildcraft/BuildCraftEnergy.java | 2 +- common/buildcraft/builders/ItemBlueprint.java | 14 +- .../builders/LibraryBlueprintTypeHandler.java | 3 +- common/buildcraft/builders/TileBuilder.java | 10 +- common/buildcraft/builders/TileQuarry.java | 6 +- .../builders/gui/ContainerArchitect.java | 4 +- .../gui/ContainerBlueprintLibrary.java | 4 +- .../buildcraft/builders/gui/GuiBuilder.java | 5 +- .../buildcraft/core/AchievementManager.java | 2 +- common/buildcraft/core/BlockSpring.java | 2 +- common/buildcraft/core/DefaultProps.java | 3 - common/buildcraft/core/EntityLaser.java | 28 ++-- common/buildcraft/core/PowerMode.java | 2 +- common/buildcraft/core/ZonePlan.java | 2 +- .../core/blueprints/BlueprintBase.java | 12 +- .../buildcraft/core/config/ConfigManager.java | 4 +- .../core/lib/AchievementManager.java | 36 ----- .../core/lib/gui/GuiBuildCraft.java | 10 +- .../core/lib/gui/buttons/LockButtonState.java | 2 +- .../buttons/StandardButtonTextureSets.java | 2 +- .../core/lib/network/IGuiReturnHandler.java | 2 +- .../core/lib/utils/CraftingUtils.java | 6 +- .../lib/utils/IterableAlgorithmRunner.java | 5 +- .../core/lib/utils/PathFindingSearch.java | 5 +- .../core/lib/utils/XorShift128Random.java | 4 +- .../core/properties/DimensionProperty.java | 8 +- .../core/properties/WorldPropertyIsOre.java | 3 +- common/buildcraft/core/proxy/CoreProxy.java | 4 - .../core/recipes/AssemblyRecipeManager.java | 3 - .../core/recipes/FlexibleRecipe.java | 4 +- .../TriggerFluidContainerLevel.java | 2 +- .../statements/TriggerInventoryLevel.java | 2 +- common/buildcraft/core/tablet/TabletBase.java | 2 +- .../core/tablet/TabletRenderer.java | 2 +- .../energy/gui/ContainerEngine.java | 4 +- common/buildcraft/factory/BlockPlainPipe.java | 8 +- common/buildcraft/factory/BlockTank.java | 2 +- .../factory/gui/ContainerAutoWorkbench.java | 4 +- .../factory/gui/ContainerRefinery.java | 4 +- common/buildcraft/robotics/EntityRobot.java | 39 +++-- common/buildcraft/robotics/RobotRegistry.java | 2 +- .../buildcraft/robotics/ai/AIRobotBreak.java | 5 +- .../ai/AIRobotGotoStationAndLoad.java | 2 +- .../ai/AIRobotSearchRandomGroundBlock.java | 3 +- common/buildcraft/robotics/map/MapUtils.java | 2 +- common/buildcraft/robotics/map/MapWorld.java | 2 +- .../statements/ActionRobotWorkInArea.java | 6 +- .../silicon/ItemRedstoneChipset.java | 2 +- .../gui/ContainerAdvancedCraftingTable.java | 4 +- .../silicon/gui/ContainerAssemblyTable.java | 4 +- .../silicon/gui/ContainerChargingTable.java | 6 +- .../gui/ContainerIntegrationTable.java | 4 +- .../gui/ContainerProgrammingTable.java | 4 +- .../silicon/gui/ContainerStampingTable.java | 4 +- .../silicon/render/PackageFontRenderer.java | 4 +- .../transport/BlockGenericPipe.java | 7 +- common/buildcraft/transport/IEmeraldPipe.java | 4 +- .../transport/IMCHandlerTransport.java | 15 +- .../buildcraft/transport/ItemGateCopier.java | 4 +- common/buildcraft/transport/Pipe.java | 5 +- .../transport/PipeIconProvider.java | 6 +- .../transport/PipeTransportItems.java | 3 - .../buildcraft/transport/TileGenericPipe.java | 16 +- .../transport/TransportSiliconRecipes.java | 12 +- .../transport/gates/ActionIterator.java | 2 +- .../transport/gates/GateDefinition.java | 8 +- .../transport/gui/ContainerEmzuliPipe.java | 4 +- .../transport/gui/ContainerGateInterface.java | 4 +- .../transport/pipes/PipeFluidsDiamond.java | 2 +- .../transport/render/GateItemRenderer.java | 1 - .../statements/ActionSignalOutput.java | 2 +- .../transport/statements/ActionValve.java | 2 +- .../statements/TriggerClockTimer.java | 2 +- 74 files changed, 250 insertions(+), 317 deletions(-) delete mode 100644 common/buildcraft/core/lib/AchievementManager.java diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index 38581d66..0c61ba94 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -280,92 +280,88 @@ public class BuildCraftCore extends BuildCraftMod { mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.cfg")); mainConfigManager = new ConfigManager(mainConfiguration); - try { - mainConfiguration.load(); + mainConfiguration.load(); - mainConfigManager.getCat("debug").setShowInGui(false); - mainConfigManager.getCat("vars").setShowInGui(false); + mainConfigManager.getCat("debug").setShowInGui(false); + mainConfigManager.getCat("vars").setShowInGui(false); - mainConfigManager.register("general.updateCheck", true, "Should I check the BuildCraft version on startup?", ConfigManager.RestartRequirement.NONE); - mainConfigManager.register("display.hidePowerValues", false, "Should all power values (RF, RF/t) be hidden?", ConfigManager.RestartRequirement.NONE); - mainConfigManager.register("display.hideFluidValues", false, "Should all fluid values (mB, mB/t) be hidden?", ConfigManager.RestartRequirement.NONE); - mainConfigManager.register("general.itemLifespan", 60, "How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60)", ConfigManager.RestartRequirement.NONE) - .setMinValue(5); - mainConfigManager.register("network.updateFactor", 10, "How often, in ticks, should network update packets be sent? Increasing this might help network performance.", ConfigManager.RestartRequirement.GAME) - .setMinValue(1); - mainConfigManager.register("network.longUpdateFactor", 40, "How often, in ticks, should full network sync packets be sent? Increasing this might help network performance.", ConfigManager.RestartRequirement.GAME) - .setMinValue(1); - mainConfigManager.register("general.canEnginesExplode", false, "Should engines explode upon overheat?", ConfigManager.RestartRequirement.NONE); - mainConfigManager.register("worldgen.enable", true, "Should BuildCraft generate anything in the world?", ConfigManager.RestartRequirement.GAME); - mainConfigManager.register("general.pumpsConsumeWater", false, "Should pumps consume water? Enabling this might cause performance issues!", ConfigManager.RestartRequirement.NONE); - mainConfigManager.register("power.miningUsageMultiplier", 1.0D, "What should the multiplier of all mining-related power usage be?", ConfigManager.RestartRequirement.NONE); - mainConfigManager.register("display.colorBlindMode", false, "Should I enable colorblind mode?", ConfigManager.RestartRequirement.GAME); - mainConfigManager.register("worldgen.generateWaterSprings", true, "Should BuildCraft generate water springs?", ConfigManager.RestartRequirement.GAME); + mainConfigManager.register("general.updateCheck", true, "Should I check the BuildCraft version on startup?", ConfigManager.RestartRequirement.NONE); + mainConfigManager.register("display.hidePowerValues", false, "Should all power values (RF, RF/t) be hidden?", ConfigManager.RestartRequirement.NONE); + mainConfigManager.register("display.hideFluidValues", false, "Should all fluid values (mB, mB/t) be hidden?", ConfigManager.RestartRequirement.NONE); + mainConfigManager.register("general.itemLifespan", 60, "How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60)", ConfigManager.RestartRequirement.NONE) + .setMinValue(5); + mainConfigManager.register("network.updateFactor", 10, "How often, in ticks, should network update packets be sent? Increasing this might help network performance.", ConfigManager.RestartRequirement.GAME) + .setMinValue(1); + mainConfigManager.register("network.longUpdateFactor", 40, "How often, in ticks, should full network sync packets be sent? Increasing this might help network performance.", ConfigManager.RestartRequirement.GAME) + .setMinValue(1); + mainConfigManager.register("general.canEnginesExplode", false, "Should engines explode upon overheat?", ConfigManager.RestartRequirement.NONE); + mainConfigManager.register("worldgen.enable", true, "Should BuildCraft generate anything in the world?", ConfigManager.RestartRequirement.GAME); + mainConfigManager.register("general.pumpsConsumeWater", false, "Should pumps consume water? Enabling this might cause performance issues!", ConfigManager.RestartRequirement.NONE); + mainConfigManager.register("power.miningUsageMultiplier", 1.0D, "What should the multiplier of all mining-related power usage be?", ConfigManager.RestartRequirement.NONE); + mainConfigManager.register("display.colorBlindMode", false, "Should I enable colorblind mode?", ConfigManager.RestartRequirement.GAME); + mainConfigManager.register("worldgen.generateWaterSprings", true, "Should BuildCraft generate water springs?", ConfigManager.RestartRequirement.GAME); - reloadConfig(ConfigManager.RestartRequirement.GAME); + reloadConfig(ConfigManager.RestartRequirement.GAME); - wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem"); - CoreProxy.proxy.registerItem(wrenchItem); + wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem"); + CoreProxy.proxy.registerItem(wrenchItem); - mapLocationItem = (new ItemMapLocation()).setUnlocalizedName("mapLocation"); - CoreProxy.proxy.registerItem(mapLocationItem); + mapLocationItem = (new ItemMapLocation()).setUnlocalizedName("mapLocation"); + CoreProxy.proxy.registerItem(mapLocationItem); - listItem = (ItemList) ((new ItemList()).setUnlocalizedName("list")); - CoreProxy.proxy.registerItem(listItem); + listItem = (ItemList) (new ItemList()).setUnlocalizedName("list"); + CoreProxy.proxy.registerItem(listItem); - debuggerItem = (ItemDebugger) ((new ItemDebugger())).setUnlocalizedName("debugger"); - CoreProxy.proxy.registerItem(debuggerItem); + debuggerItem = (new ItemDebugger()).setUnlocalizedName("debugger"); + CoreProxy.proxy.registerItem(debuggerItem); - if (BuildCraftCore.modifyWorld) { - BlockSpring.EnumSpring.WATER.canGen = BuildCraftCore.mainConfigManager.get("worldgen.generateWaterSprings").getBoolean(); - springBlock = new BlockSpring().setBlockName("eternalSpring"); - CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class); - } - - woodenGearItem = (new ItemGear()).setUnlocalizedName("woodenGearItem"); - CoreProxy.proxy.registerItem(woodenGearItem); - OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem)); - - stoneGearItem = (new ItemGear()).setUnlocalizedName("stoneGearItem"); - CoreProxy.proxy.registerItem(stoneGearItem); - OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem)); - - ironGearItem = (new ItemGear()).setUnlocalizedName("ironGearItem"); - CoreProxy.proxy.registerItem(ironGearItem); - OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem)); - - goldGearItem = (new ItemGear()).setUnlocalizedName("goldGearItem"); - CoreProxy.proxy.registerItem(goldGearItem); - OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem)); - - diamondGearItem = (new ItemGear()).setUnlocalizedName("diamondGearItem"); - CoreProxy.proxy.registerItem(diamondGearItem); - OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem)); - - paintbrushItem = (new ItemPaintbrush()).setUnlocalizedName("paintbrush"); - CoreProxy.proxy.registerItem(paintbrushItem); - - if (TABLET_TESTING) { - tabletItem = new ItemTablet(); - tabletItem.setUnlocalizedName("tablet"); - CoreProxy.proxy.registerItem(tabletItem); - } - - buildToolBlock = new BlockBuildTool(); - buildToolBlock.setBlockName("buildToolBlock"); - CoreProxy.proxy.registerBlock(buildToolBlock); - - engineBlock = (BlockEngine) CompatHooks.INSTANCE.getBlock(BlockEngine.class); - CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class); - engineBlock.registerTile((Class) CompatHooks.INSTANCE.getTile(TileEngineWood.class), "tile.engineWood"); - CoreProxy.proxy.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood"); - - FMLCommonHandler.instance().bus().register(this); - MinecraftForge.EVENT_BUS.register(this); - MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler()); - } finally { + if (BuildCraftCore.modifyWorld) { + BlockSpring.EnumSpring.WATER.canGen = BuildCraftCore.mainConfigManager.get("worldgen.generateWaterSprings").getBoolean(); + springBlock = new BlockSpring().setBlockName("eternalSpring"); + CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class); } + woodenGearItem = (new ItemGear()).setUnlocalizedName("woodenGearItem"); + CoreProxy.proxy.registerItem(woodenGearItem); + OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem)); + + stoneGearItem = (new ItemGear()).setUnlocalizedName("stoneGearItem"); + CoreProxy.proxy.registerItem(stoneGearItem); + OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem)); + + ironGearItem = (new ItemGear()).setUnlocalizedName("ironGearItem"); + CoreProxy.proxy.registerItem(ironGearItem); + OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem)); + + goldGearItem = (new ItemGear()).setUnlocalizedName("goldGearItem"); + CoreProxy.proxy.registerItem(goldGearItem); + OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem)); + + diamondGearItem = (new ItemGear()).setUnlocalizedName("diamondGearItem"); + CoreProxy.proxy.registerItem(diamondGearItem); + OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem)); + + paintbrushItem = (new ItemPaintbrush()).setUnlocalizedName("paintbrush"); + CoreProxy.proxy.registerItem(paintbrushItem); + + if (TABLET_TESTING) { + tabletItem = new ItemTablet(); + tabletItem.setUnlocalizedName("tablet"); + CoreProxy.proxy.registerItem(tabletItem); + } + + buildToolBlock = new BlockBuildTool(); + buildToolBlock.setBlockName("buildToolBlock"); + CoreProxy.proxy.registerBlock(buildToolBlock); + + engineBlock = (BlockEngine) CompatHooks.INSTANCE.getBlock(BlockEngine.class); + CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class); + engineBlock.registerTile((Class) CompatHooks.INSTANCE.getTile(TileEngineWood.class), "tile.engineWood"); + CoreProxy.proxy.registerTileEntity(TileEngineWood.class, "net.minecraft.src.buildcraft.energy.TileEngineWood"); + + FMLCommonHandler.instance().bus().register(this); + MinecraftForge.EVENT_BUS.register(this); + MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler()); } @Mod.EventHandler diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index bc2c297f..90941d68 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -422,7 +422,7 @@ public class BuildCraftEnergy extends BuildCraftMod { } private int findUnusedBiomeID(String biomeName) { - int freeBiomeID = 0; + int freeBiomeID; // code to find a free biome for (int i = 1; i < 256; i++) { if (BiomeGenBase.getBiomeGenArray()[i] == null) { diff --git a/common/buildcraft/builders/ItemBlueprint.java b/common/buildcraft/builders/ItemBlueprint.java index 110decc5..9c33b3a6 100644 --- a/common/buildcraft/builders/ItemBlueprint.java +++ b/common/buildcraft/builders/ItemBlueprint.java @@ -49,14 +49,14 @@ public abstract class ItemBlueprint extends ItemBuildCraft implements IBlueprint String name = NBTUtils.getItemData(stack).getString("name"); if ("".equals(name)) { - list.add(String.format(StringUtils.localize("item.blueprint.unnamed"))); + list.add(StringUtils.localize("item.blueprint.unnamed")); } else { - list.add(String.format (name)); + list.add(name); } - list.add(String.format(StringUtils.localize("item.blueprint.author") + list.add(StringUtils.localize("item.blueprint.author") + " " - + NBTUtils.getItemData(stack).getString("author"))); + + NBTUtils.getItemData(stack).getString("author")); } else { list.add(StringUtils.localize("item.blueprint.blank")); } @@ -65,9 +65,9 @@ public abstract class ItemBlueprint extends ItemBuildCraft implements IBlueprint BuildingPermission p = BuildingPermission.values()[NBTUtils.getItemData(stack).getByte("permission")]; if (p == BuildingPermission.CREATIVE_ONLY) { - list.add(String.format(StringUtils.localize("item.blueprint.creative_only"))); + list.add(StringUtils.localize("item.blueprint.creative_only")); } else if (p == BuildingPermission.NONE) { - list.add(String.format(StringUtils.localize("item.blueprint.no_build"))); + list.add(StringUtils.localize("item.blueprint.no_build")); } } @@ -75,7 +75,7 @@ public abstract class ItemBlueprint extends ItemBuildCraft implements IBlueprint boolean isComplete = NBTUtils.getItemData(stack).getBoolean("isComplete"); if (!isComplete) { - list.add(String.format(StringUtils.localize("item.blueprint.incomplete"))); + list.add(StringUtils.localize("item.blueprint.incomplete")); } } } diff --git a/common/buildcraft/builders/LibraryBlueprintTypeHandler.java b/common/buildcraft/builders/LibraryBlueprintTypeHandler.java index 8a2a4883..59c1223e 100644 --- a/common/buildcraft/builders/LibraryBlueprintTypeHandler.java +++ b/common/buildcraft/builders/LibraryBlueprintTypeHandler.java @@ -32,7 +32,8 @@ public class LibraryBlueprintTypeHandler extends LibraryTypeHandlerNBT { @Override public String getName(ItemStack stack) { - return ItemBlueprint.getId(stack).name; + LibraryId id = ItemBlueprint.getId(stack); + return id != null ? id.name : "<>"; } @Override diff --git a/common/buildcraft/builders/TileBuilder.java b/common/buildcraft/builders/TileBuilder.java index 3d77b7b5..d727b2c1 100644 --- a/common/buildcraft/builders/TileBuilder.java +++ b/common/buildcraft/builders/TileBuilder.java @@ -161,12 +161,8 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid AxisAlignedBB boundingBox = bpt.getBoundingBox(); if (oldBoundingBox == null || !collision(oldBoundingBox, boundingBox)) { - oldBoundingBox = boundingBox; - - if (bpt != null) { - return bpt; - } + return bpt; } ix += cx; @@ -301,7 +297,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid } public BlueprintBase instanciateBlueprint() { - BlueprintBase bpt = null; + BlueprintBase bpt; try { bpt = ItemBlueprint.loadBlueprint(getStackInSlot(0)); @@ -650,7 +646,7 @@ public class TileBuilder extends TileAbstractBuilder implements IHasWork, IFluid stack.setTagCompound(NetworkUtils.readNBT(stream)); } - if (stack != null && stack.getItem() != null) { + if (stack.getItem() != null) { requiredToBuild.add(new RequirementItemStack(stack, stackSize & 0x7FFFFF)); } else { BCLog.logger.error("Corrupt ItemStack in TileBuilder.receiveCommand! This should not happen! (ID " + itemId + ", damage " + itemDamage + ")"); diff --git a/common/buildcraft/builders/TileQuarry.java b/common/buildcraft/builders/TileQuarry.java index 1d60796b..b31f1b08 100644 --- a/common/buildcraft/builders/TileQuarry.java +++ b/common/buildcraft/builders/TileQuarry.java @@ -249,9 +249,9 @@ public class TileQuarry extends TileAbstractBuilder implements IHasWork, ISidedI double[] head = getHead(); AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(head[0] - 2, head[1] - 2, head[2] - 2, head[0] + 3, head[1] + 3, head[2] + 3); List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis); - for (int ii = 0; ii < result.size(); ii++) { - if (result.get(ii) instanceof EntityItem) { - EntityItem entity = (EntityItem) result.get(ii); + for (Object aResult : result) { + if (aResult instanceof EntityItem) { + EntityItem entity = (EntityItem) aResult; if (entity.isDead) { continue; } diff --git a/common/buildcraft/builders/gui/ContainerArchitect.java b/common/buildcraft/builders/gui/ContainerArchitect.java index 25928e61..1bd18e16 100644 --- a/common/buildcraft/builders/gui/ContainerArchitect.java +++ b/common/buildcraft/builders/gui/ContainerArchitect.java @@ -56,8 +56,8 @@ public class ContainerArchitect extends BuildCraftContainer { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - ICrafting icrafting = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting icrafting = (ICrafting) crafter; if (computingTime != architect.getComputingProgressScaled(24)) { icrafting.sendProgressBarUpdate(this, 0, architect.getComputingProgressScaled(24)); } diff --git a/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java b/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java index a3a0ae9d..cf9e351f 100644 --- a/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java +++ b/common/buildcraft/builders/gui/ContainerBlueprintLibrary.java @@ -50,8 +50,8 @@ public class ContainerBlueprintLibrary extends BuildCraftContainer { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - ICrafting icrafting = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting icrafting = (ICrafting) crafter; if (progressIn != library.progressIn) { icrafting.sendProgressBarUpdate(this, 0, library.progressIn); } diff --git a/common/buildcraft/builders/gui/GuiBuilder.java b/common/buildcraft/builders/gui/GuiBuilder.java index bd237539..6511fc8b 100644 --- a/common/buildcraft/builders/gui/GuiBuilder.java +++ b/common/buildcraft/builders/gui/GuiBuilder.java @@ -22,6 +22,7 @@ import buildcraft.BuildCraftCore; import buildcraft.builders.TileBuilder; import buildcraft.core.blueprints.RequirementItemStack; import buildcraft.core.lib.fluids.Tank; +import buildcraft.core.lib.gui.AdvancedSlot; import buildcraft.core.lib.gui.GuiAdvancedInterface; import buildcraft.core.lib.network.command.CommandWriter; import buildcraft.core.lib.network.command.PacketCommand; @@ -113,8 +114,8 @@ public class GuiBuilder extends GuiAdvancedInterface { } else { sbPosition = 0; sbLength = 0; - for (int s = 0; s < slots.size(); s++) { - ((BuilderRequirementSlot) slots.get(s)).stack = null; + for (AdvancedSlot slot : slots) { + ((BuilderRequirementSlot) slot).stack = null; } for (GuiButton b : (List) buttonList) { b.visible = false; diff --git a/common/buildcraft/core/AchievementManager.java b/common/buildcraft/core/AchievementManager.java index 7ed83a4c..575e3668 100644 --- a/common/buildcraft/core/AchievementManager.java +++ b/common/buildcraft/core/AchievementManager.java @@ -7,7 +7,7 @@ import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraftforge.common.AchievementPage; public class AchievementManager { - public AchievementPage page; + public final AchievementPage page; public AchievementManager(String name) { page = new AchievementPage(name); diff --git a/common/buildcraft/core/BlockSpring.java b/common/buildcraft/core/BlockSpring.java index 3a68d438..8f62477e 100644 --- a/common/buildcraft/core/BlockSpring.java +++ b/common/buildcraft/core/BlockSpring.java @@ -36,7 +36,7 @@ public class BlockSpring extends Block { public Block liquidBlock; public boolean canGen = true; - private EnumSpring(int tickRate, int chance, Block liquidBlock) { + EnumSpring(int tickRate, int chance, Block liquidBlock) { this.tickRate = tickRate; this.chance = chance; this.liquidBlock = liquidBlock; diff --git a/common/buildcraft/core/DefaultProps.java b/common/buildcraft/core/DefaultProps.java index c0bce314..1a61021e 100644 --- a/common/buildcraft/core/DefaultProps.java +++ b/common/buildcraft/core/DefaultProps.java @@ -13,9 +13,6 @@ public final class DefaultProps { public static final String MOD = "BuildCraft"; public static final String DEPENDENCY_CORE = "required-after:BuildCraft|Core@" + Version.VERSION; - public static final String DEPENDENCY_TRANSPORT = "required-after:BuildCraft|Transport@" + Version.VERSION; - public static final String DEPENDENCY_SILICON = "required-after:BuildCraft|Silicon@" + Version.VERSION; - public static final String DEPENDENCY_SILICON_TRANSPORT = DEPENDENCY_TRANSPORT + ";" + DEPENDENCY_SILICON; public static final String NET_CHANNEL_NAME = "BC"; public static final int MAX_NAME_SIZE = 32; diff --git a/common/buildcraft/core/EntityLaser.java b/common/buildcraft/core/EntityLaser.java index bea00869..491c53f2 100644 --- a/common/buildcraft/core/EntityLaser.java +++ b/common/buildcraft/core/EntityLaser.java @@ -53,14 +53,14 @@ public abstract class EntityLaser extends Entity { noClip = true; isImmuneToFire = true; - dataWatcher.addObject(8, Integer.valueOf(0)); - dataWatcher.addObject(9, Integer.valueOf(0)); - dataWatcher.addObject(10, Integer.valueOf(0)); - dataWatcher.addObject(11, Integer.valueOf(0)); - dataWatcher.addObject(12, Integer.valueOf(0)); - dataWatcher.addObject(13, Integer.valueOf(0)); + dataWatcher.addObject(8, 0); + dataWatcher.addObject(9, 0); + dataWatcher.addObject(10, 0); + dataWatcher.addObject(11, 0); + dataWatcher.addObject(12, 0); + dataWatcher.addObject(13, 0); - dataWatcher.addObject(14, Byte.valueOf((byte) 0)); + dataWatcher.addObject(14, (byte) 0); } @Override @@ -110,14 +110,14 @@ public abstract class EntityLaser extends Entity { } protected void updateDataServer() { - dataWatcher.updateObject(8, Integer.valueOf(encodeDouble(data.head.x))); - dataWatcher.updateObject(9, Integer.valueOf(encodeDouble(data.head.y))); - dataWatcher.updateObject(10, Integer.valueOf(encodeDouble(data.head.z))); - dataWatcher.updateObject(11, Integer.valueOf(encodeDouble(data.tail.x))); - dataWatcher.updateObject(12, Integer.valueOf(encodeDouble(data.tail.y))); - dataWatcher.updateObject(13, Integer.valueOf(encodeDouble(data.tail.z))); + dataWatcher.updateObject(8, encodeDouble(data.head.x)); + dataWatcher.updateObject(9, encodeDouble(data.head.y)); + dataWatcher.updateObject(10, encodeDouble(data.head.z)); + dataWatcher.updateObject(11, encodeDouble(data.tail.x)); + dataWatcher.updateObject(12, encodeDouble(data.tail.y)); + dataWatcher.updateObject(13, encodeDouble(data.tail.z)); - dataWatcher.updateObject(14, Byte.valueOf((byte) (data.isVisible ? 1 : 0))); + dataWatcher.updateObject(14, (byte) (data.isVisible ? 1 : 0)); } public void setPositions(Position head, Position tail) { diff --git a/common/buildcraft/core/PowerMode.java b/common/buildcraft/core/PowerMode.java index 9d7f7d1b..d1b5c716 100644 --- a/common/buildcraft/core/PowerMode.java +++ b/common/buildcraft/core/PowerMode.java @@ -6,7 +6,7 @@ public enum PowerMode { public static final PowerMode[] VALUES = values(); public final int maxPower; - private PowerMode(int max) { + PowerMode(int max) { this.maxPower = max; } diff --git a/common/buildcraft/core/ZonePlan.java b/common/buildcraft/core/ZonePlan.java index 665743ed..1226e28c 100755 --- a/common/buildcraft/core/ZonePlan.java +++ b/common/buildcraft/core/ZonePlan.java @@ -23,7 +23,7 @@ import buildcraft.api.core.ISerializable; import buildcraft.api.core.IZone; public class ZonePlan implements IZone, ISerializable { - private HashMap chunkMapping = new HashMap(); + private final HashMap chunkMapping = new HashMap(); public boolean get(int x, int z) { int xChunk = x >> 4; diff --git a/common/buildcraft/core/blueprints/BlueprintBase.java b/common/buildcraft/core/blueprints/BlueprintBase.java index de74faaf..af294d1d 100644 --- a/common/buildcraft/core/blueprints/BlueprintBase.java +++ b/common/buildcraft/core/blueprints/BlueprintBase.java @@ -79,17 +79,17 @@ public abstract class BlueprintBase { } public void translateToBlueprint(Translation transform) { - for (int i = 0; i < contents.length; i++) { - if (contents[i] != null) { - contents[i].translateToBlueprint(transform); + for (SchematicBlockBase content : contents) { + if (content != null) { + content.translateToBlueprint(transform); } } } public void translateToWorld(Translation transform) { - for (int i = 0; i < contents.length; i++) { - if (contents[i] != null) { - contents[i].translateToWorld(transform); + for (SchematicBlockBase content : contents) { + if (content != null) { + content.translateToWorld(transform); } } } diff --git a/common/buildcraft/core/config/ConfigManager.java b/common/buildcraft/core/config/ConfigManager.java index 8c104cdc..4e181ee8 100644 --- a/common/buildcraft/core/config/ConfigManager.java +++ b/common/buildcraft/core/config/ConfigManager.java @@ -29,7 +29,7 @@ public class ConfigManager implements IModGuiFactory { } public enum RestartRequirement { - NONE, WORLD, GAME; + NONE, WORLD, GAME } public ConfigManager() { @@ -55,7 +55,7 @@ public class ConfigManager implements IModGuiFactory { } private Property create(String s, Object o) { - Property p = null; + Property p; if (o instanceof Integer) { p = new Property(s, o.toString(), Property.Type.INTEGER); } else if (o instanceof String) { diff --git a/common/buildcraft/core/lib/AchievementManager.java b/common/buildcraft/core/lib/AchievementManager.java deleted file mode 100644 index 757567e7..00000000 --- a/common/buildcraft/core/lib/AchievementManager.java +++ /dev/null @@ -1,36 +0,0 @@ -package buildcraft.core.lib; - -import net.minecraft.item.Item; -import net.minecraft.stats.Achievement; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; -import net.minecraftforge.common.AchievementPage; - -public class AchievementManager { - public AchievementPage page; - - public AchievementManager(String name) { - page = new AchievementPage(name); - AchievementPage.registerAchievementPage(page); - - FMLCommonHandler.instance().bus().register(this); - } - - public Achievement registerAchievement(Achievement a) { - page.getAchievements().add(a.registerStat()); - return a; - } - - @SubscribeEvent - public void onCrafting(PlayerEvent.ItemCraftedEvent event) { - Item item = event.crafting.getItem(); - int damage = event.crafting.getItemDamage(); - - for (Achievement a : page.getAchievements()) { - if (item.equals(a.theItemStack.getItem()) && damage == a.theItemStack.getItemDamage()) { - event.player.addStat(a, 1); - } - } - } -} diff --git a/common/buildcraft/core/lib/gui/GuiBuildCraft.java b/common/buildcraft/core/lib/gui/GuiBuildCraft.java index 0bdfec83..5a31cc17 100644 --- a/common/buildcraft/core/lib/gui/GuiBuildCraft.java +++ b/common/buildcraft/core/lib/gui/GuiBuildCraft.java @@ -370,8 +370,7 @@ public abstract class GuiBuildCraft extends GuiContainer { int xShift = ((gui.width - gui.xSize) / 2) + gui.xSize; int yShift = ((gui.height - gui.ySize) / 2) + 8; - for (int i = 0; i < ledgers.size(); i++) { - Ledger ledger = ledgers.get(i); + for (Ledger ledger : ledgers) { if (!ledger.isVisible()) { continue; } @@ -389,8 +388,7 @@ public abstract class GuiBuildCraft extends GuiContainer { } protected void drawLedgers(int mouseX, int mouseY) { - - int xPos = 8; + int yPos = 8; for (Ledger ledger : ledgers) { ledger.update(); @@ -398,8 +396,8 @@ public abstract class GuiBuildCraft extends GuiContainer { continue; } - ledger.draw(xSize, xPos); - xPos += ledger.getHeight(); + ledger.draw(xSize, yPos); + yPos += ledger.getHeight(); } Ledger ledger = getAtPosition(mouseX, mouseY); diff --git a/common/buildcraft/core/lib/gui/buttons/LockButtonState.java b/common/buildcraft/core/lib/gui/buttons/LockButtonState.java index 6e045a21..cdd9ac1a 100644 --- a/common/buildcraft/core/lib/gui/buttons/LockButtonState.java +++ b/common/buildcraft/core/lib/gui/buttons/LockButtonState.java @@ -16,7 +16,7 @@ public enum LockButtonState implements IMultiButtonState { public static final LockButtonState[] VALUES = values(); private final IButtonTextureSet texture; - private LockButtonState(IButtonTextureSet texture) { + LockButtonState(IButtonTextureSet texture) { this.texture = texture; } diff --git a/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java b/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java index 8afd2438..2f78dfdb 100644 --- a/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java +++ b/common/buildcraft/core/lib/gui/buttons/StandardButtonTextureSets.java @@ -18,7 +18,7 @@ public enum StandardButtonTextureSets implements IButtonTextureSet { public static final ResourceLocation BUTTON_TEXTURES = new ResourceLocation("buildcraftcore:textures/gui/buttons.png"); private final int x, y, height, width; - private StandardButtonTextureSets(int x, int y, int height, int width) { + StandardButtonTextureSets(int x, int y, int height, int width) { this.x = x; this.y = y; this.height = height; diff --git a/common/buildcraft/core/lib/network/IGuiReturnHandler.java b/common/buildcraft/core/lib/network/IGuiReturnHandler.java index d68ac522..ec393a76 100644 --- a/common/buildcraft/core/lib/network/IGuiReturnHandler.java +++ b/common/buildcraft/core/lib/network/IGuiReturnHandler.java @@ -13,7 +13,7 @@ import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public abstract interface IGuiReturnHandler { +public interface IGuiReturnHandler { World getWorld(); void writeGuiData(ByteBuf data); diff --git a/common/buildcraft/core/lib/utils/CraftingUtils.java b/common/buildcraft/core/lib/utils/CraftingUtils.java index edef070b..f8dea94e 100644 --- a/common/buildcraft/core/lib/utils/CraftingUtils.java +++ b/common/buildcraft/core/lib/utils/CraftingUtils.java @@ -75,10 +75,10 @@ public final class CraftingUtils { // End repair recipe handler List recipes = CraftingManager.getInstance().getRecipeList(); - for (int index = 0; index < recipes.size(); ++index) { - IRecipe currentRecipe = (IRecipe) recipes.get(index); + for (Object recipe : recipes) { + IRecipe currentRecipe = (IRecipe) recipe; - if (currentRecipe.matches(par1InventoryCrafting, par2World)) { + if (currentRecipe.matches(par1InventoryCrafting, par2World)) { return currentRecipe; } } diff --git a/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java b/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java index 938d4387..d6a3740f 100755 --- a/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java +++ b/common/buildcraft/core/lib/utils/IterableAlgorithmRunner.java @@ -38,12 +38,11 @@ public class IterableAlgorithmRunner extends Thread { } long startTime = new Date().getTime(); - long elapsedtime = 0; pathFinding.iterate(); - elapsedtime = new Date().getTime() - startTime; - double timeToWait = elapsedtime * 1.5; + long elapsedTime = new Date().getTime() - startTime; + double timeToWait = elapsedTime * 1.5; sleep((long) timeToWait); } } catch (Throwable t) { diff --git a/common/buildcraft/core/lib/utils/PathFindingSearch.java b/common/buildcraft/core/lib/utils/PathFindingSearch.java index b1039619..8455ca13 100644 --- a/common/buildcraft/core/lib/utils/PathFindingSearch.java +++ b/common/buildcraft/core/lib/utils/PathFindingSearch.java @@ -23,9 +23,8 @@ import buildcraft.api.core.IZone; public class PathFindingSearch implements IIterableAlgorithm { - public static int PATH_ITERATIONS = 1000; - - private static HashMap> reservations = new HashMap>(); + public static final int PATH_ITERATIONS = 1000; + private static final HashMap> reservations = new HashMap>(); private World world; private BlockIndex start; diff --git a/common/buildcraft/core/lib/utils/XorShift128Random.java b/common/buildcraft/core/lib/utils/XorShift128Random.java index 98be5054..11b59fea 100644 --- a/common/buildcraft/core/lib/utils/XorShift128Random.java +++ b/common/buildcraft/core/lib/utils/XorShift128Random.java @@ -10,7 +10,7 @@ import java.util.Random; public class XorShift128Random { private static final Random seed = new Random(); private static final double DOUBLE_UNIT = 0x1.0p-53; - private long[] s = new long[2]; + private final long[] s = new long[2]; public XorShift128Random() { s[0] = seed.nextLong(); @@ -27,7 +27,7 @@ public class XorShift128Random { } public int nextInt() { - return (int) (nextLong() & 0xFFFFFFFF); + return (int) nextLong(); } public boolean nextBoolean() { diff --git a/common/buildcraft/core/properties/DimensionProperty.java b/common/buildcraft/core/properties/DimensionProperty.java index f0af0012..d6ab8a6e 100644 --- a/common/buildcraft/core/properties/DimensionProperty.java +++ b/common/buildcraft/core/properties/DimensionProperty.java @@ -19,10 +19,10 @@ import net.minecraft.world.chunk.Chunk; public class DimensionProperty implements IWorldAccess { - private LongHashMap chunkMapping = new LongHashMap(); - private World world; - private int worldHeight; - private WorldProperty worldProperty; + private final LongHashMap chunkMapping = new LongHashMap(); + private final World world; + private final int worldHeight; + private final WorldProperty worldProperty; public DimensionProperty(World iWorld, WorldProperty iProp) { world = iWorld; diff --git a/common/buildcraft/core/properties/WorldPropertyIsOre.java b/common/buildcraft/core/properties/WorldPropertyIsOre.java index bafc0ba5..546f774a 100755 --- a/common/buildcraft/core/properties/WorldPropertyIsOre.java +++ b/common/buildcraft/core/properties/WorldPropertyIsOre.java @@ -22,8 +22,7 @@ import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.oredict.OreDictionary; public class WorldPropertyIsOre extends WorldProperty { - - public HashSet ores = new HashSet(); + private final HashSet ores = new HashSet(); public WorldPropertyIsOre(int harvestLevel) { initBlockHarvestTools(); diff --git a/common/buildcraft/core/proxy/CoreProxy.java b/common/buildcraft/core/proxy/CoreProxy.java index b81f1ca9..4de5fe73 100644 --- a/common/buildcraft/core/proxy/CoreProxy.java +++ b/common/buildcraft/core/proxy/CoreProxy.java @@ -103,14 +103,10 @@ public class CoreProxy implements ICoreProxy { @SuppressWarnings("unchecked") public void addCraftingRecipe(ItemStack result, Object... recipe) { - String name = Item.itemRegistry.getNameForObject(result.getItem()); - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(result, recipe)); } public void addShapelessRecipe(ItemStack result, Object... recipe) { - String name = Item.itemRegistry.getNameForObject(result.getItem()); - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(result, recipe)); } diff --git a/common/buildcraft/core/recipes/AssemblyRecipeManager.java b/common/buildcraft/core/recipes/AssemblyRecipeManager.java index fede4b8e..b8922768 100644 --- a/common/buildcraft/core/recipes/AssemblyRecipeManager.java +++ b/common/buildcraft/core/recipes/AssemblyRecipeManager.java @@ -12,7 +12,6 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import buildcraft.api.recipes.IAssemblyRecipeManager; @@ -25,8 +24,6 @@ public class AssemblyRecipeManager implements IAssemblyRecipeManager { @Override public void addRecipe(String id, int energyCost, ItemStack output, Object... input) { - String name = Item.itemRegistry.getNameForObject(output.getItem()); - addRecipe(id, new FlexibleRecipe(id, output, energyCost, 0, input)); } diff --git a/common/buildcraft/core/recipes/FlexibleRecipe.java b/common/buildcraft/core/recipes/FlexibleRecipe.java index d1e7b5fa..22aceeff 100644 --- a/common/buildcraft/core/recipes/FlexibleRecipe.java +++ b/common/buildcraft/core/recipes/FlexibleRecipe.java @@ -186,7 +186,7 @@ public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeVie FluidStack fluid = crafter.getCraftingFluidStack(tankid); if (fluid != null && fluid.isFluidEqual(requirement)) { - int amountUsed = 0; + int amountUsed; if (fluid.amount > amount) { amountUsed = amount; @@ -239,7 +239,7 @@ public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeVie ItemStack stack = crafter.getCraftingItemStack(slotid); if (stack != null && filter.matches(stack)) { - ItemStack removed = null; + ItemStack removed; if (stack.stackSize >= expected) { removed = crafter.decrCraftingItemStack(slotid, expected); diff --git a/common/buildcraft/core/statements/TriggerFluidContainerLevel.java b/common/buildcraft/core/statements/TriggerFluidContainerLevel.java index 2b18f211..a0a50598 100644 --- a/common/buildcraft/core/statements/TriggerFluidContainerLevel.java +++ b/common/buildcraft/core/statements/TriggerFluidContainerLevel.java @@ -32,7 +32,7 @@ public class TriggerFluidContainerLevel extends BCStatement implements ITriggerE public final float level; - private TriggerType(float level) { + TriggerType(float level) { this.level = level; } } diff --git a/common/buildcraft/core/statements/TriggerInventoryLevel.java b/common/buildcraft/core/statements/TriggerInventoryLevel.java index 6b74f2ab..278524fc 100644 --- a/common/buildcraft/core/statements/TriggerInventoryLevel.java +++ b/common/buildcraft/core/statements/TriggerInventoryLevel.java @@ -32,7 +32,7 @@ public class TriggerInventoryLevel extends BCStatement implements ITriggerExtern BELOW25(0.25F), BELOW50(0.5F), BELOW75(0.75F); public final float level; - private TriggerType(float level) { + TriggerType(float level) { this.level = level; } } diff --git a/common/buildcraft/core/tablet/TabletBase.java b/common/buildcraft/core/tablet/TabletBase.java index a19dae14..1835ff83 100644 --- a/common/buildcraft/core/tablet/TabletBase.java +++ b/common/buildcraft/core/tablet/TabletBase.java @@ -11,7 +11,7 @@ import buildcraft.api.tablet.TabletProgram; import buildcraft.api.tablet.TabletProgramFactory; public abstract class TabletBase implements ITablet { - protected LinkedList programs = new LinkedList(); + protected final LinkedList programs = new LinkedList(); protected TabletBase() { diff --git a/common/buildcraft/core/tablet/TabletRenderer.java b/common/buildcraft/core/tablet/TabletRenderer.java index 3fe033a1..ace3dc7b 100644 --- a/common/buildcraft/core/tablet/TabletRenderer.java +++ b/common/buildcraft/core/tablet/TabletRenderer.java @@ -5,7 +5,7 @@ import buildcraft.api.tablet.TabletTicker; class TabletRenderer { private TabletBitmap currDisplay, newDisplay; - private TabletTicker refreshRate = new TabletTicker(0.035F); + private final TabletTicker refreshRate = new TabletTicker(0.035F); private boolean changed = false; private boolean isTicking = false; private int tickLocation = 7; diff --git a/common/buildcraft/energy/gui/ContainerEngine.java b/common/buildcraft/energy/gui/ContainerEngine.java index a6477c25..91797b41 100644 --- a/common/buildcraft/energy/gui/ContainerEngine.java +++ b/common/buildcraft/energy/gui/ContainerEngine.java @@ -48,8 +48,8 @@ public class ContainerEngine extends BuildCraftContainer { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - engine.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + engine.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/factory/BlockPlainPipe.java b/common/buildcraft/factory/BlockPlainPipe.java index 0580625e..4f8fc3de 100644 --- a/common/buildcraft/factory/BlockPlainPipe.java +++ b/common/buildcraft/factory/BlockPlainPipe.java @@ -23,9 +23,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import buildcraft.core.CoreConstants; -import buildcraft.core.internal.IFramePipeConnection; -public class BlockPlainPipe extends Block implements IFramePipeConnection { +public class BlockPlainPipe extends Block { public BlockPlainPipe() { super(Material.glass); @@ -54,11 +53,6 @@ public class BlockPlainPipe extends Block implements IFramePipeConnection { return false; } - @Override - public boolean isPipeConnected(IBlockAccess blockAccess, int x1, int y1, int z1, int x2, int y2, int z2) { - return false; - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void getSubBlocks(Item item, CreativeTabs tab, List list) { diff --git a/common/buildcraft/factory/BlockTank.java b/common/buildcraft/factory/BlockTank.java index f2a7d167..f19d6488 100644 --- a/common/buildcraft/factory/BlockTank.java +++ b/common/buildcraft/factory/BlockTank.java @@ -169,7 +169,7 @@ public class BlockTank extends BlockBuildCraft { int qtyToFill = container.fill(current, liquid, true); tank.drain(ForgeDirection.UNKNOWN, qtyToFill, true); } else if (mustFill || entityplayer.isSneaking()) { - if (liquid != null && liquid.amount > 0) { + if (liquid.amount > 0) { int qty = tank.fill(ForgeDirection.UNKNOWN, liquid, false); tank.fill(ForgeDirection.UNKNOWN, container.drain(current, qty, true), true); } diff --git a/common/buildcraft/factory/gui/ContainerAutoWorkbench.java b/common/buildcraft/factory/gui/ContainerAutoWorkbench.java index 1b7d6edd..c49242d2 100644 --- a/common/buildcraft/factory/gui/ContainerAutoWorkbench.java +++ b/common/buildcraft/factory/gui/ContainerAutoWorkbench.java @@ -68,8 +68,8 @@ public class ContainerAutoWorkbench extends BuildCraftContainer { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - ICrafting icrafting = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting icrafting = (ICrafting) crafter; if (lastProgress != tile.progress) { icrafting.sendProgressBarUpdate(this, 0, tile.progress); diff --git a/common/buildcraft/factory/gui/ContainerRefinery.java b/common/buildcraft/factory/gui/ContainerRefinery.java index 1c01c5f1..30de8d2d 100644 --- a/common/buildcraft/factory/gui/ContainerRefinery.java +++ b/common/buildcraft/factory/gui/ContainerRefinery.java @@ -76,8 +76,8 @@ public class ContainerRefinery extends BuildCraftContainer { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - refinery.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + refinery.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/robotics/EntityRobot.java b/common/buildcraft/robotics/EntityRobot.java index 69b02054..38bd0e7f 100644 --- a/common/buildcraft/robotics/EntityRobot.java +++ b/common/buildcraft/robotics/EntityRobot.java @@ -11,7 +11,6 @@ package buildcraft.robotics; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.UUID; import java.util.WeakHashMap; import com.google.common.collect.Iterables; @@ -180,16 +179,16 @@ public class EntityRobot extends EntityRobotBase implements isImmuneToFire = true; this.func_110163_bv(); // persistenceRequired = true - dataWatcher.addObject(12, Float.valueOf(0)); - dataWatcher.addObject(13, Float.valueOf(0)); - dataWatcher.addObject(14, Float.valueOf(0)); - dataWatcher.addObject(15, Byte.valueOf((byte) 0)); + dataWatcher.addObject(12, (float) 0); + dataWatcher.addObject(13, (float) 0); + dataWatcher.addObject(14, (float) 0); + dataWatcher.addObject(15, (byte) 0); dataWatcher.addObject(16, ""); - dataWatcher.addObject(17, Float.valueOf(0)); - dataWatcher.addObject(18, Float.valueOf(0)); - dataWatcher.addObject(19, Integer.valueOf(0)); - dataWatcher.addObject(20, Byte.valueOf((byte) 0)); - dataWatcher.addObject(21, Integer.valueOf(0)); + dataWatcher.addObject(17, (float) 0); + dataWatcher.addObject(18, (float) 0); + dataWatcher.addObject(19, 0); + dataWatcher.addObject(20, (byte) 0); + dataWatcher.addObject(21, 0); } protected void updateDataClient() { @@ -213,12 +212,12 @@ public class EntityRobot extends EntityRobotBase implements } protected void updateDataServer() { - dataWatcher.updateObject(12, Float.valueOf((float) laser.tail.x)); - dataWatcher.updateObject(13, Float.valueOf((float) laser.tail.y)); - dataWatcher.updateObject(14, Float.valueOf((float) laser.tail.z)); - dataWatcher.updateObject(15, Byte.valueOf((byte) (laser.isVisible ? 1 : 0))); - dataWatcher.updateObject(17, Float.valueOf(itemAngle1)); - dataWatcher.updateObject(18, Float.valueOf(itemAngle2)); + dataWatcher.updateObject(12, (float) laser.tail.x); + dataWatcher.updateObject(13, (float) laser.tail.y); + dataWatcher.updateObject(14, (float) laser.tail.z); + dataWatcher.updateObject(15, (byte) (laser.isVisible ? 1 : 0)); + dataWatcher.updateObject(17, itemAngle1); + dataWatcher.updateObject(18, itemAngle2); } public boolean isActive() { @@ -289,7 +288,7 @@ public class EntityRobot extends EntityRobotBase implements if (!worldObj.isRemote) { // The client-side sleep indicator should also display if the robot is charging. // To not break gates and other things checking for sleep, this is done here. - dataWatcher.updateObject(20, Byte.valueOf((byte) ((isActive() && ticksCharging == 0) ? 1 : 0))); + dataWatcher.updateObject(20, (byte) ((isActive() && ticksCharging == 0) ? 1 : 0)); dataWatcher.updateObject(21, getEnergy()); if (needsUpdate) { @@ -516,9 +515,9 @@ public class EntityRobot extends EntityRobotBase implements if (wearables.size() > 0) { NBTTagList wearableList = new NBTTagList(); - for (int i = 0; i < wearables.size(); i++) { + for (ItemStack wearable : wearables) { NBTTagCompound item = new NBTTagCompound(); - wearables.get(i).writeToNBT(item); + wearable.writeToNBT(item); wearableList.appendTag(item); } @@ -1121,7 +1120,7 @@ public class EntityRobot extends EntityRobotBase implements gameProfile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkullOwner")); } else if (nbttagcompound.hasKey("SkullOwner", NBT.TAG_STRING) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner"))) { - gameProfile = new GameProfile((UUID) null, nbttagcompound.getString("SkullOwner")); + gameProfile = new GameProfile(null, nbttagcompound.getString("SkullOwner")); } if (gameProfile != null && !StringUtils.isNullOrEmpty(gameProfile.getName())) { if (!gameProfile.isComplete() diff --git a/common/buildcraft/robotics/RobotRegistry.java b/common/buildcraft/robotics/RobotRegistry.java index aec24802..f0cedcf4 100755 --- a/common/buildcraft/robotics/RobotRegistry.java +++ b/common/buildcraft/robotics/RobotRegistry.java @@ -345,7 +345,7 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry { for (int i = 0; i < stationList.tagCount(); ++i) { NBTTagCompound cpt = stationList.getCompoundTagAt(i); - Class cls = null; + Class cls; if (!cpt.hasKey("stationType")) { cls = DockingStationPipe.class; diff --git a/common/buildcraft/robotics/ai/AIRobotBreak.java b/common/buildcraft/robotics/ai/AIRobotBreak.java index 351b61d2..9eb8ce09 100644 --- a/common/buildcraft/robotics/ai/AIRobotBreak.java +++ b/common/buildcraft/robotics/ai/AIRobotBreak.java @@ -115,12 +115,11 @@ public class AIRobotBreak extends AIRobot { if (f > 1.0F) { int i = EnchantmentHelper.getEfficiencyModifier(robot); - ItemStack itemstack = usingItem; - if (i > 0 && itemstack != null) { + if (i > 0) { float f1 = i * i + 1; - boolean canHarvest = ForgeHooks.canToolHarvestBlock(block, meta, itemstack); + boolean canHarvest = ForgeHooks.canToolHarvestBlock(block, meta, usingItem); if (!canHarvest && f <= 1.0F) { f += f1 * 0.08F; diff --git a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java index 6222e8db..d19a6307 100755 --- a/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java +++ b/common/buildcraft/robotics/ai/AIRobotGotoStationAndLoad.java @@ -42,7 +42,7 @@ public class AIRobotGotoStationAndLoad extends AIRobot { setSuccess(false); terminate(); } - } else if (ai instanceof AIRobotGotoStationToLoad) { + } else if (ai instanceof AIRobotLoad) { setSuccess(ai.success()); terminate(); } diff --git a/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java b/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java index 6475ae7f..b4a47923 100755 --- a/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchRandomGroundBlock.java @@ -52,8 +52,7 @@ public class AIRobotSearchRandomGroundBlock extends AIRobot { terminate(); } - int x = 0; - int z = 0; + int x, z; if (zone == null) { double r = robot.worldObj.rand.nextFloat() * range; diff --git a/common/buildcraft/robotics/map/MapUtils.java b/common/buildcraft/robotics/map/MapUtils.java index 5d4e7ede..00d483c9 100644 --- a/common/buildcraft/robotics/map/MapUtils.java +++ b/common/buildcraft/robotics/map/MapUtils.java @@ -10,7 +10,7 @@ public final class MapUtils { } public static int getXFromID(long id) { - return (int) ((id >> 24) & 0xFFFFFFFF); + return (int) (id >> 24); } public static int getZFromID(long id) { diff --git a/common/buildcraft/robotics/map/MapWorld.java b/common/buildcraft/robotics/map/MapWorld.java index e605ea09..f7a6cfd3 100644 --- a/common/buildcraft/robotics/map/MapWorld.java +++ b/common/buildcraft/robotics/map/MapWorld.java @@ -152,7 +152,7 @@ public class MapWorld { public void updateChunkDelayed(Chunk chunk, byte time) { synchronized (timeToUpdate) { - timeToUpdate.put(chunk, new Integer(time)); + timeToUpdate.put(chunk, (int) time); } } } diff --git a/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java b/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java index a6ab4557..8a1f7625 100755 --- a/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java +++ b/common/buildcraft/robotics/statements/ActionRobotWorkInArea.java @@ -27,9 +27,9 @@ public class ActionRobotWorkInArea extends BCStatement implements IActionInterna WORK("work_in_area"), LOAD_UNLOAD("load_unload_area"); - private String name; + private final String name; - private AreaType(String iName) { + AreaType(String iName) { name = iName; } @@ -46,7 +46,7 @@ public class ActionRobotWorkInArea extends BCStatement implements IActionInterna } } - private AreaType areaType; + private final AreaType areaType; public ActionRobotWorkInArea(AreaType iAreaType) { super(iAreaType.getTag()); diff --git a/common/buildcraft/silicon/ItemRedstoneChipset.java b/common/buildcraft/silicon/ItemRedstoneChipset.java index 88e03b40..65c693f0 100644 --- a/common/buildcraft/silicon/ItemRedstoneChipset.java +++ b/common/buildcraft/silicon/ItemRedstoneChipset.java @@ -27,7 +27,7 @@ import buildcraft.core.lib.items.ItemBuildCraft; public class ItemRedstoneChipset extends ItemBuildCraft { - public static enum Chipset { + public enum Chipset { RED, IRON, diff --git a/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java b/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java index d400ddb9..27716765 100644 --- a/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java +++ b/common/buildcraft/silicon/gui/ContainerAdvancedCraftingTable.java @@ -67,8 +67,8 @@ public class ContainerAdvancedCraftingTable extends BuildCraftContainer { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - workbench.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + workbench.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/silicon/gui/ContainerAssemblyTable.java b/common/buildcraft/silicon/gui/ContainerAssemblyTable.java index e63ebffb..8e27b342 100644 --- a/common/buildcraft/silicon/gui/ContainerAssemblyTable.java +++ b/common/buildcraft/silicon/gui/ContainerAssemblyTable.java @@ -59,8 +59,8 @@ public class ContainerAssemblyTable extends BuildCraftContainer { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/silicon/gui/ContainerChargingTable.java b/common/buildcraft/silicon/gui/ContainerChargingTable.java index 19c7b095..4548169a 100644 --- a/common/buildcraft/silicon/gui/ContainerChargingTable.java +++ b/common/buildcraft/silicon/gui/ContainerChargingTable.java @@ -52,8 +52,8 @@ public class ContainerChargingTable extends BuildCraftContainer { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); - } + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); + } } } diff --git a/common/buildcraft/silicon/gui/ContainerIntegrationTable.java b/common/buildcraft/silicon/gui/ContainerIntegrationTable.java index e9b195af..566b92d8 100644 --- a/common/buildcraft/silicon/gui/ContainerIntegrationTable.java +++ b/common/buildcraft/silicon/gui/ContainerIntegrationTable.java @@ -59,8 +59,8 @@ public class ContainerIntegrationTable extends BuildCraftContainer { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/silicon/gui/ContainerProgrammingTable.java b/common/buildcraft/silicon/gui/ContainerProgrammingTable.java index 869694c3..e30210de 100644 --- a/common/buildcraft/silicon/gui/ContainerProgrammingTable.java +++ b/common/buildcraft/silicon/gui/ContainerProgrammingTable.java @@ -55,8 +55,8 @@ public class ContainerProgrammingTable extends BuildCraftContainer { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } } diff --git a/common/buildcraft/silicon/gui/ContainerStampingTable.java b/common/buildcraft/silicon/gui/ContainerStampingTable.java index dfba569f..ad9fbe5d 100644 --- a/common/buildcraft/silicon/gui/ContainerStampingTable.java +++ b/common/buildcraft/silicon/gui/ContainerStampingTable.java @@ -51,8 +51,8 @@ public class ContainerStampingTable extends BuildCraftContainer { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); i++) { - table.sendGUINetworkData(this, (ICrafting) crafters.get(i)); + for (Object crafter : crafters) { + table.sendGUINetworkData(this, (ICrafting) crafter); } } diff --git a/common/buildcraft/silicon/render/PackageFontRenderer.java b/common/buildcraft/silicon/render/PackageFontRenderer.java index 2731077d..1c41c1b9 100644 --- a/common/buildcraft/silicon/render/PackageFontRenderer.java +++ b/common/buildcraft/silicon/render/PackageFontRenderer.java @@ -26,7 +26,7 @@ public class PackageFontRenderer extends FontRenderer { @Override public int getStringWidth(String s) { - if (s.indexOf("SPECIAL:") < 0) { + if (!s.contains("SPECIAL:")) { return realRenderer.getStringWidth(s); } @@ -35,7 +35,7 @@ public class PackageFontRenderer extends FontRenderer { @Override public int drawString(String s, int x, int y, int color, boolean shadow) { - if (s.indexOf("SPECIAL:") < 0) { + if (!s.contains("SPECIAL:")) { return realRenderer.drawString(s, x, y, color, shadow); } diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index dca01052..896fbe85 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -74,7 +74,7 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable private static final ForgeDirection[] DIR_VALUES = ForgeDirection.values(); - public static enum Part { + public enum Part { Pipe, Pluggable } @@ -485,10 +485,9 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable return null; } - @SideOnly(Side.CLIENT) @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { - RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, Minecraft.getMinecraft().thePlayer); + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { + RaytraceResult rayTraceResult = doRayTrace(world, x, y, z, player); if (rayTraceResult != null && rayTraceResult.boundingBox != null) { switch (rayTraceResult.hitPart) { diff --git a/common/buildcraft/transport/IEmeraldPipe.java b/common/buildcraft/transport/IEmeraldPipe.java index 1bbecbf6..c61ad5cc 100644 --- a/common/buildcraft/transport/IEmeraldPipe.java +++ b/common/buildcraft/transport/IEmeraldPipe.java @@ -4,11 +4,11 @@ import net.minecraft.nbt.NBTTagCompound; public interface IEmeraldPipe extends IFilteredPipe { - public enum FilterMode { + enum FilterMode { WHITE_LIST, BLACK_LIST, ROUND_ROBIN } - public class EmeraldPipeSettings { + class EmeraldPipeSettings { private FilterMode filterMode; public EmeraldPipeSettings(FilterMode defaultMode) { diff --git a/common/buildcraft/transport/IMCHandlerTransport.java b/common/buildcraft/transport/IMCHandlerTransport.java index 429490eb..65448477 100644 --- a/common/buildcraft/transport/IMCHandlerTransport.java +++ b/common/buildcraft/transport/IMCHandlerTransport.java @@ -37,13 +37,14 @@ public class IMCHandlerTransport extends IMCHandler { NBTTagCompound recipe = msg.getNBTValue(); if (!recipe.hasKey("id") || !recipe.hasKey("expansion") || !recipe.hasKey("input")) { failed = true; - return; - } - IGateExpansion exp = GateExpansions.getExpansion(recipe.getString("expansion")); - ItemStack is = ItemStack.loadItemStackFromNBT(recipe.getCompoundTag("input")); - if (exp == null || is == null) { - failed = true; - return; + } else { + IGateExpansion exp = GateExpansions.getExpansion(recipe.getString("expansion")); + ItemStack is = ItemStack.loadItemStackFromNBT(recipe.getCompoundTag("input")); + if (exp == null || is == null) { + failed = true; + } else { + GateExpansions.registerExpansion(exp, is); + } } } if (failed) { diff --git a/common/buildcraft/transport/ItemGateCopier.java b/common/buildcraft/transport/ItemGateCopier.java index 480dd4e5..30261fa9 100644 --- a/common/buildcraft/transport/ItemGateCopier.java +++ b/common/buildcraft/transport/ItemGateCopier.java @@ -110,7 +110,9 @@ public class ItemGateCopier extends ItemBuildCraft { player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.warning.load")); } - ((TileGenericPipe) tile).sendUpdateToClient(); + if (tile instanceof TileGenericPipe) { + ((TileGenericPipe) tile).sendUpdateToClient(); + } player.addChatMessage(new ChatComponentTranslation("chat.gateCopier.gatePasted")); return true; } diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index 221888b2..e3c55e8f 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -10,6 +10,7 @@ package buildcraft.transport; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Random; @@ -440,9 +441,7 @@ public abstract class Pipe implements IDropControlInven for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) { if (container.hasPipePluggable(direction)) { - for (ItemStack stack : container.getPipePluggable(direction).getDropItems(container)) { - result.add(stack); - } + Collections.addAll(result, container.getPipePluggable(direction).getDropItems(container)); } } diff --git a/common/buildcraft/transport/PipeIconProvider.java b/common/buildcraft/transport/PipeIconProvider.java index f93ff1dd..abd5ce02 100644 --- a/common/buildcraft/transport/PipeIconProvider.java +++ b/common/buildcraft/transport/PipeIconProvider.java @@ -152,18 +152,18 @@ public class PipeIconProvider implements IIconProvider { private final String iconTagColorBlind; private IIcon icon; - private TYPE(String iconTag, String iconTagColorBlind) { + TYPE(String iconTag, String iconTagColorBlind) { this.iconTag = iconTag; this.iconTagColorBlind = iconTagColorBlind; } - private TYPE(String iconTag) { + TYPE(String iconTag) { this(iconTag, iconTag); } private void registerIcon(IIconRegister iconRegister) { String name = BuildCraftCore.colorBlindMode ? iconTagColorBlind : iconTag; - if (name.indexOf(":") < 0) { + if (!name.contains(":")) { name = "transport:pipes/" + name; } icon = iconRegister.registerIcon("buildcraft" + name); diff --git a/common/buildcraft/transport/PipeTransportItems.java b/common/buildcraft/transport/PipeTransportItems.java index ba107e43..07db3502 100644 --- a/common/buildcraft/transport/PipeTransportItems.java +++ b/common/buildcraft/transport/PipeTransportItems.java @@ -230,9 +230,6 @@ public class PipeTransportItems extends PipeTransport implements IDebuggable { if (entity instanceof IPipeTile) { Pipe pipe = (Pipe) ((IPipeTile) entity).getPipe(); - if (pipe == null || pipe.transport == null) { - return false; - } if (pipe == null || pipe.transport == null) { return false; diff --git a/common/buildcraft/transport/TileGenericPipe.java b/common/buildcraft/transport/TileGenericPipe.java index 8d8ab590..779a8484 100644 --- a/common/buildcraft/transport/TileGenericPipe.java +++ b/common/buildcraft/transport/TileGenericPipe.java @@ -148,13 +148,15 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler, } else { pluggableClass = PipeManager.getPluggableByName(pluggableData.getString("pluggableName")); } - if (!PipePluggable.class.isAssignableFrom(pluggableClass)) { - BCLog.logger.warn("Wrong pluggable class: " + pluggableClass); - continue; + if (pluggableClass != null) { + if (!PipePluggable.class.isAssignableFrom(pluggableClass)) { + BCLog.logger.warn("Wrong pluggable class: " + pluggableClass); + continue; + } + PipePluggable pluggable = (PipePluggable) pluggableClass.newInstance(); + pluggable.readFromNBT(pluggableData); + pluggables[i] = pluggable; } - PipePluggable pluggable = (PipePluggable) pluggableClass.newInstance(); - pluggable.readFromNBT(pluggableData); - pluggables[i] = pluggable; } catch (Exception e) { BCLog.logger.warn("Failed to load side state"); e.printStackTrace(); @@ -1014,7 +1016,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler, break; } - if (pipe == null && coreState.pipeId != 0) { + if (coreState.pipeId != 0) { initialize(BlockGenericPipe.createPipe((Item) Item.itemRegistry.getObjectById(coreState.pipeId))); } diff --git a/common/buildcraft/transport/TransportSiliconRecipes.java b/common/buildcraft/transport/TransportSiliconRecipes.java index 87a99141..3c309daf 100644 --- a/common/buildcraft/transport/TransportSiliconRecipes.java +++ b/common/buildcraft/transport/TransportSiliconRecipes.java @@ -51,16 +51,16 @@ public final class TransportSiliconRecipes { } // GATES - BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:simpleGate", (int) Math.round(100000 * BuildCraftTransport.gateCostMultiplier), + BuildcraftRecipeRegistry.assemblyTable.addRecipe("buildcraft:simpleGate", Math.round(100000 * BuildCraftTransport.gateCostMultiplier), ItemGate.makeGateItem(GateDefinition.GateMaterial.REDSTONE, GateDefinition.GateLogic.AND), ItemRedstoneChipset.Chipset.RED.getStack(), PipeWire.RED.getStack()); - addGateRecipe("Iron", (int) Math.round(200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.IRON, ItemRedstoneChipset.Chipset.IRON, PipeWire.RED, PipeWire.BLUE); - addGateRecipe("Gold", (int) Math.round(400000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.GOLD, ItemRedstoneChipset.Chipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); - addGateRecipe("Quartz", (int) Math.round(600000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.QUARTZ, ItemRedstoneChipset.Chipset.QUARTZ, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); - addGateRecipe("Diamond", (int) Math.round(800000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.DIAMOND, ItemRedstoneChipset.Chipset.DIAMOND, PipeWire.RED, PipeWire.BLUE, + addGateRecipe("Iron", Math.round(200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.IRON, ItemRedstoneChipset.Chipset.IRON, PipeWire.RED, PipeWire.BLUE); + addGateRecipe("Gold", Math.round(400000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.GOLD, ItemRedstoneChipset.Chipset.GOLD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); + addGateRecipe("Quartz", Math.round(600000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.QUARTZ, ItemRedstoneChipset.Chipset.QUARTZ, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN); + addGateRecipe("Diamond", Math.round(800000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.DIAMOND, ItemRedstoneChipset.Chipset.DIAMOND, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN, PipeWire.YELLOW); - addGateRecipe("Emerald", (int) Math.round(1200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.EMERALD, ItemRedstoneChipset.Chipset.EMERALD, PipeWire.RED, PipeWire.BLUE, + addGateRecipe("Emerald", Math.round(1200000 * BuildCraftTransport.gateCostMultiplier), GateDefinition.GateMaterial.EMERALD, ItemRedstoneChipset.Chipset.EMERALD, PipeWire.RED, PipeWire.BLUE, PipeWire.GREEN, PipeWire.YELLOW); BuildcraftRecipeRegistry.integrationTable.addRecipe(new GateExpansionRecipe()); diff --git a/common/buildcraft/transport/gates/ActionIterator.java b/common/buildcraft/transport/gates/ActionIterator.java index 1997b538..1af6ad9c 100755 --- a/common/buildcraft/transport/gates/ActionIterator.java +++ b/common/buildcraft/transport/gates/ActionIterator.java @@ -17,7 +17,7 @@ import buildcraft.api.transport.IPipe; import buildcraft.transport.Gate; public class ActionIterator implements Iterable { - private IPipe pipe; + private final IPipe pipe; public ActionIterator(IPipe iPipe) { pipe = iPipe; diff --git a/common/buildcraft/transport/gates/GateDefinition.java b/common/buildcraft/transport/gates/GateDefinition.java index 6a16b9c4..915a4028 100644 --- a/common/buildcraft/transport/gates/GateDefinition.java +++ b/common/buildcraft/transport/gates/GateDefinition.java @@ -32,7 +32,7 @@ public final class GateDefinition { } } - public static enum GateMaterial { + public enum GateMaterial { REDSTONE("gate_interface_1.png", 146, 1, 0, 0, 1), IRON("gate_interface_2.png", 164, 2, 0, 0, 2), @@ -53,8 +53,8 @@ public final class GateDefinition { @SideOnly(Side.CLIENT) private IIcon iconItem; - private GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots, - int actionParameterSlots, int maxWireColor) { + GateMaterial(String guiFile, int guiHeight, int numSlots, int triggerParameterSlots, + int actionParameterSlots, int maxWireColor) { this.guiFile = new ResourceLocation("buildcrafttransport:textures/gui/" + guiFile); this.guiHeight = guiHeight; this.numSlots = numSlots; @@ -99,7 +99,7 @@ public final class GateDefinition { } } - public static enum GateLogic { + public enum GateLogic { AND, OR; public static final GateLogic[] VALUES = values(); diff --git a/common/buildcraft/transport/gui/ContainerEmzuliPipe.java b/common/buildcraft/transport/gui/ContainerEmzuliPipe.java index 41321bb5..5ad07a08 100644 --- a/common/buildcraft/transport/gui/ContainerEmzuliPipe.java +++ b/common/buildcraft/transport/gui/ContainerEmzuliPipe.java @@ -84,8 +84,8 @@ public class ContainerEmzuliPipe extends BuildCraftContainer { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < crafters.size(); ++i) { - ICrafting player = (ICrafting) crafters.get(i); + for (Object crafter : crafters) { + ICrafting player = (ICrafting) crafter; for (int slot = 0; slot < pipe.slotColors.length; slot++) { if (prevSlotColors[slot] != pipe.slotColors[slot]) { diff --git a/common/buildcraft/transport/gui/ContainerGateInterface.java b/common/buildcraft/transport/gui/ContainerGateInterface.java index 82a9a8b6..81470755 100644 --- a/common/buildcraft/transport/gui/ContainerGateInterface.java +++ b/common/buildcraft/transport/gui/ContainerGateInterface.java @@ -217,8 +217,8 @@ public class ContainerGateInterface extends BuildCraftContainer implements IComm int state = calculateTriggerState(); if (state != lastTriggerState) { - for (int i = 0; i < this.crafters.size(); i++) { - ICrafting viewingPlayer = (ICrafting) this.crafters.get(i); + for (Object crafter : this.crafters) { + ICrafting viewingPlayer = (ICrafting) crafter; viewingPlayer.sendProgressBarUpdate(this, 0 /* State update */, state); } diff --git a/common/buildcraft/transport/pipes/PipeFluidsDiamond.java b/common/buildcraft/transport/pipes/PipeFluidsDiamond.java index 5fb654c4..7ca05ebd 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsDiamond.java +++ b/common/buildcraft/transport/pipes/PipeFluidsDiamond.java @@ -133,7 +133,7 @@ public class PipeFluidsDiamond extends Pipe implements IDia Fluid fluidInTank = event.fluidStack.getFluid(); Set originalDestinations = new HashSet(); originalDestinations.addAll(event.destinations.elementSet()); - boolean isFiltered = true; + boolean isFiltered = false; int[] filterCount = new int[6]; for (ForgeDirection dir : originalDestinations) { diff --git a/common/buildcraft/transport/render/GateItemRenderer.java b/common/buildcraft/transport/render/GateItemRenderer.java index 2229678f..1ba7d0c0 100644 --- a/common/buildcraft/transport/render/GateItemRenderer.java +++ b/common/buildcraft/transport/render/GateItemRenderer.java @@ -110,7 +110,6 @@ public class GateItemRenderer implements IItemRenderer { if (count > 0) { float offsetX = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float offsetY = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; - float z = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; GL11.glTranslatef(offsetX, offsetY, offsetZ); } else { GL11.glTranslatef(0f, 0f, offsetZ); diff --git a/common/buildcraft/transport/statements/ActionSignalOutput.java b/common/buildcraft/transport/statements/ActionSignalOutput.java index baa44275..cef3ede2 100644 --- a/common/buildcraft/transport/statements/ActionSignalOutput.java +++ b/common/buildcraft/transport/statements/ActionSignalOutput.java @@ -22,7 +22,7 @@ import buildcraft.transport.Gate; public class ActionSignalOutput extends BCStatement implements IActionInternal { - public PipeWire color; + public final PipeWire color; public ActionSignalOutput(PipeWire color) { super("buildcraft:pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH), "buildcraft.pipe.wire.output." + color.name().toLowerCase(Locale.ENGLISH)); diff --git a/common/buildcraft/transport/statements/ActionValve.java b/common/buildcraft/transport/statements/ActionValve.java index 7c2838d2..51d31bfe 100644 --- a/common/buildcraft/transport/statements/ActionValve.java +++ b/common/buildcraft/transport/statements/ActionValve.java @@ -36,7 +36,7 @@ public class ActionValve extends BCStatement implements IActionInternal { public final boolean inputOpen; public final boolean outputOpen; - private ValveState(boolean in, boolean out) { + ValveState(boolean in, boolean out) { inputOpen = in; outputOpen = out; } diff --git a/common/buildcraft/transport/statements/TriggerClockTimer.java b/common/buildcraft/transport/statements/TriggerClockTimer.java index 584ee5b2..3e4e6ee9 100644 --- a/common/buildcraft/transport/statements/TriggerClockTimer.java +++ b/common/buildcraft/transport/statements/TriggerClockTimer.java @@ -26,7 +26,7 @@ public class TriggerClockTimer extends BCStatement implements ITriggerInternal { public static final Time[] VALUES = values(); public final int delay; - private Time(int delay) { + Time(int delay) { this.delay = delay; } }