code cleanup

This commit is contained in:
asiekierka 2015-06-28 22:28:47 +02:00
parent 902e5505f6
commit c085a1e9a2
74 changed files with 250 additions and 317 deletions

View file

@ -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<? extends TileEngineBase>) 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<? extends TileEngineBase>) 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

View file

@ -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) {

View file

@ -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"));
}
}
}

View file

@ -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 : "<<CORRUPT>>";
}
@Override

View file

@ -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 + ")");

View file

@ -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;
}

View file

@ -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));
}

View file

@ -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);
}

View file

@ -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<GuiButton>) buttonList) {
b.visible = false;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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;
}

View file

@ -23,7 +23,7 @@ import buildcraft.api.core.ISerializable;
import buildcraft.api.core.IZone;
public class ZonePlan implements IZone, ISerializable {
private HashMap<ChunkIndex, ZoneChunk> chunkMapping = new HashMap<ChunkIndex, ZoneChunk>();
private final HashMap<ChunkIndex, ZoneChunk> chunkMapping = new HashMap<ChunkIndex, ZoneChunk>();
public boolean get(int x, int z) {
int xChunk = x >> 4;

View file

@ -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);
}
}
}

View file

@ -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) {

View file

@ -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);
}
}
}
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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) {

View file

@ -23,9 +23,8 @@ import buildcraft.api.core.IZone;
public class PathFindingSearch implements IIterableAlgorithm {
public static int PATH_ITERATIONS = 1000;
private static HashMap<Integer, HashSet<BlockIndex>> reservations = new HashMap<Integer, HashSet<BlockIndex>>();
public static final int PATH_ITERATIONS = 1000;
private static final HashMap<Integer, HashSet<BlockIndex>> reservations = new HashMap<Integer, HashSet<BlockIndex>>();
private World world;
private BlockIndex start;

View file

@ -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() {

View file

@ -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;

View file

@ -22,8 +22,7 @@ import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.oredict.OreDictionary;
public class WorldPropertyIsOre extends WorldProperty {
public HashSet<Integer> ores = new HashSet<Integer>();
private final HashSet<Integer> ores = new HashSet<Integer>();
public WorldPropertyIsOre(int harvestLevel) {
initBlockHarvestTools();

View file

@ -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));
}

View file

@ -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<ItemStack>(id, output, energyCost, 0, input));
}

View file

@ -186,7 +186,7 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, 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<T> implements IFlexibleRecipe<T>, 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);

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -11,7 +11,7 @@ import buildcraft.api.tablet.TabletProgram;
import buildcraft.api.tablet.TabletProgramFactory;
public abstract class TabletBase implements ITablet {
protected LinkedList<TabletProgram> programs = new LinkedList<TabletProgram>();
protected final LinkedList<TabletProgram> programs = new LinkedList<TabletProgram>();
protected TabletBase() {

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);

View file

@ -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);
}
}
}

View file

@ -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()

View file

@ -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<? extends DockingStation> cls = null;
Class<? extends DockingStation> cls;
if (!cpt.hasKey("stationType")) {
cls = DockingStationPipe.class;

View file

@ -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;

View file

@ -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();
}

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}
}
}

View file

@ -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());

View file

@ -27,7 +27,7 @@ import buildcraft.core.lib.items.ItemBuildCraft;
public class ItemRedstoneChipset extends ItemBuildCraft {
public static enum Chipset {
public enum Chipset {
RED,
IRON,

View file

@ -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);
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}
}

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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;
}

View file

@ -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<T extends PipeTransport> 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));
}
}

View file

@ -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);

View file

@ -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;

View file

@ -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)));
}

View file

@ -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());

View file

@ -17,7 +17,7 @@ import buildcraft.api.transport.IPipe;
import buildcraft.transport.Gate;
public class ActionIterator implements Iterable<StatementSlot> {
private IPipe pipe;
private final IPipe pipe;
public ActionIterator(IPipe iPipe) {
pipe = iPipe;

View file

@ -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();

View file

@ -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]) {

View file

@ -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);
}

View file

@ -133,7 +133,7 @@ public class PipeFluidsDiamond extends Pipe<PipeTransportFluids> implements IDia
Fluid fluidInTank = event.fluidStack.getFluid();
Set<ForgeDirection> originalDestinations = new HashSet<ForgeDirection>();
originalDestinations.addAll(event.destinations.elementSet());
boolean isFiltered = true;
boolean isFiltered = false;
int[] filterCount = new int[6];
for (ForgeDirection dir : originalDestinations) {

View file

@ -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);

View file

@ -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));

View file

@ -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;
}

View file

@ -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;
}
}