harden source code with IntelliJ checking tools
This commit is contained in:
parent
91a5d42821
commit
f5d885343d
56 changed files with 67 additions and 103 deletions
|
@ -9,6 +9,7 @@
|
||||||
package buildcraft.api.blueprints;
|
package buildcraft.api.blueprints;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -39,9 +40,7 @@ public class SchematicBlock extends SchematicBlockBase {
|
||||||
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
if (storedRequirements.length != 0) {
|
if (storedRequirements.length != 0) {
|
||||||
for (ItemStack s : storedRequirements) {
|
Collections.addAll(requirements, storedRequirements);
|
||||||
requirements.add(s);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
requirements.add(new ItemStack(block, 1, meta));
|
requirements.add(new ItemStack(block, 1, meta));
|
||||||
}
|
}
|
||||||
|
@ -136,11 +135,9 @@ public class SchematicBlock extends SchematicBlockBase {
|
||||||
NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND);
|
NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND);
|
||||||
|
|
||||||
ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> rqs = new ArrayList<ItemStack>();
|
||||||
int idTEST = 0;
|
|
||||||
for (int i = 0; i < rq.tagCount(); ++i) {
|
for (int i = 0; i < rq.tagCount(); ++i) {
|
||||||
try {
|
try {
|
||||||
NBTTagCompound sub = rq.getCompoundTagAt(i);
|
NBTTagCompound sub = rq.getCompoundTagAt(i);
|
||||||
idTEST = sub.getInteger("id");
|
|
||||||
if (sub.getInteger("id") >= 0) {
|
if (sub.getInteger("id") >= 0) {
|
||||||
registry.stackToWorld(sub);
|
registry.stackToWorld(sub);
|
||||||
rqs.add(ItemStack.loadItemStackFromNBT(sub));
|
rqs.add(ItemStack.loadItemStackFromNBT(sub));
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package buildcraft.api.blueprints;
|
package buildcraft.api.blueprints;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -43,9 +44,7 @@ public class SchematicEntity extends Schematic {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
public void getRequirementsForPlacement(IBuilderContext context, LinkedList<ItemStack> requirements) {
|
||||||
for (ItemStack s : storedRequirements) {
|
Collections.addAll(requirements, storedRequirements);
|
||||||
requirements.add(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToWorld(IBuilderContext context) {
|
public void writeToWorld(IBuilderContext context) {
|
||||||
|
@ -115,8 +114,6 @@ public class SchematicEntity extends Schematic {
|
||||||
public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) {
|
||||||
super.writeSchematicToNBT(nbt, registry);
|
super.writeSchematicToNBT(nbt, registry);
|
||||||
|
|
||||||
NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6);
|
|
||||||
|
|
||||||
nbt.setInteger("entityId", registry.getIdForEntity(entity));
|
nbt.setInteger("entityId", registry.getIdForEntity(entity));
|
||||||
nbt.setTag("entity", entityNBT);
|
nbt.setTag("entity", entityNBT);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class JavaTools {
|
public class JavaTools {
|
||||||
|
@ -56,9 +57,7 @@ public class JavaTools {
|
||||||
Class<?> current = clas;
|
Class<?> current = clas;
|
||||||
|
|
||||||
while (current != null && current != Object.class) {
|
while (current != null && current != Object.class) {
|
||||||
for (Field f : current.getDeclaredFields()) {
|
Collections.addAll(result, current.getDeclaredFields());
|
||||||
result.add(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
current = current.getSuperclass();
|
current = current.getSuperclass();
|
||||||
}
|
}
|
||||||
|
@ -72,9 +71,7 @@ public class JavaTools {
|
||||||
Class<?> current = clas;
|
Class<?> current = clas;
|
||||||
|
|
||||||
while (current != null && current != Object.class) {
|
while (current != null && current != Object.class) {
|
||||||
for (Method m : current.getDeclaredMethods()) {
|
Collections.addAll(result, current.getDeclaredMethods());
|
||||||
result.add(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
current = current.getSuperclass();
|
current = current.getSuperclass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ public final class StatementManager {
|
||||||
result = ((IOverrideDefaultStatements) entity).overrideActions();
|
result = ((IOverrideDefaultStatements) entity).overrideActions();
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
return result;
|
return result;
|
||||||
|
} else {
|
||||||
|
result = new LinkedList<IActionExternal>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ package buildcraft.api.tiles;
|
||||||
public interface IControllable {
|
public interface IControllable {
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
Unknown, On, Off, Loop
|
Unknown, On, Off, Loop
|
||||||
};
|
}
|
||||||
|
|
||||||
Mode getControlMode();
|
Mode getControlMode();
|
||||||
void setControlMode(Mode mode);
|
void setControlMode(Mode mode);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public interface IPipeConnection {
|
||||||
enum ConnectOverride {
|
enum ConnectOverride {
|
||||||
|
|
||||||
CONNECT, DISCONNECT, DEFAULT
|
CONNECT, DISCONNECT, DEFAULT
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to override pipe connection logic.
|
* Allows you to override pipe connection logic.
|
||||||
|
|
|
@ -17,7 +17,7 @@ public interface IPipeTile {
|
||||||
|
|
||||||
public enum PipeType {
|
public enum PipeType {
|
||||||
|
|
||||||
ITEM, FLUID, POWER, STRUCTURE;
|
ITEM, FLUID, POWER, STRUCTURE
|
||||||
}
|
}
|
||||||
|
|
||||||
PipeType getPipeType();
|
PipeType getPipeType();
|
||||||
|
|
|
@ -527,7 +527,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
||||||
try {
|
try {
|
||||||
PrintWriter writer = new PrintWriter("FacadeDebug.txt", "UTF-8");
|
PrintWriter writer = new PrintWriter("FacadeDebug.txt", "UTF-8");
|
||||||
writer.println("*** REGISTERED FACADES ***");
|
writer.println("*** REGISTERED FACADES ***");
|
||||||
for (ItemStack stack : facadeItem.allFacades) {
|
for (ItemStack stack : ItemFacade.allFacades) {
|
||||||
if (facadeItem.getBlocksForFacade(stack).length > 0) {
|
if (facadeItem.getBlocksForFacade(stack).length > 0) {
|
||||||
writer.println(Block.blockRegistry.getNameForObject(facadeItem.getBlocksForFacade(stack)[0]) + ":" + facadeItem.getMetaValuesForFacade(stack)[0]);
|
writer.println(Block.blockRegistry.getNameForObject(facadeItem.getBlocksForFacade(stack)[0]) + ":" + facadeItem.getMetaValuesForFacade(stack)[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class TileFiller extends TileAbstractBuilder implements IHasWork, IContro
|
||||||
box.initialize(a);
|
box.initialize(a);
|
||||||
|
|
||||||
if (a instanceof TileMarker) {
|
if (a instanceof TileMarker) {
|
||||||
((TileMarker) a).removeFromWorld();
|
a.removeFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendNetworkUpdate();
|
sendNetworkUpdate();
|
||||||
|
|
|
@ -95,19 +95,12 @@ public class BlueprintDatabase {
|
||||||
File blueprintFile = getBlueprintFile(id, outputDir);
|
File blueprintFile = getBlueprintFile(id, outputDir);
|
||||||
|
|
||||||
if (!blueprintFile.exists()) {
|
if (!blueprintFile.exists()) {
|
||||||
OutputStream gzOs = null;
|
|
||||||
try {
|
try {
|
||||||
FileOutputStream f = new FileOutputStream(blueprintFile);
|
FileOutputStream f = new FileOutputStream(blueprintFile);
|
||||||
f.write(blueprint.getData());
|
f.write(blueprint.getData());
|
||||||
f.close();
|
f.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
BCLog.logger.error(String.format("Failed to save Blueprint file: %s %s", blueprintFile.getName(), ex.getMessage()));
|
BCLog.logger.error(String.format("Failed to save Blueprint file: %s %s", blueprintFile.getName(), ex.getMessage()));
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (gzOs != null) {
|
|
||||||
gzOs.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import buildcraft.core.utils.Utils;
|
||||||
public final class BlueprintId implements Comparable<BlueprintId>, ISerializable {
|
public final class BlueprintId implements Comparable<BlueprintId>, ISerializable {
|
||||||
public enum Kind {
|
public enum Kind {
|
||||||
Template, Blueprint
|
Template, Blueprint
|
||||||
};
|
}
|
||||||
|
|
||||||
public byte[] uniqueId;
|
public byte[] uniqueId;
|
||||||
public String name = "";
|
public String name = "";
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class SchematicMinecart extends SchematicEntity {
|
||||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||||
pos.x -= 0.5;
|
pos.x -= 0.5;
|
||||||
pos.z -= 0.5;
|
pos.z -= 0.5;
|
||||||
entityNBT.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
|
entityNBT.setTag("Pos", this.newDoubleNBTList(pos.x, pos.y, pos.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class SchematicMinecart extends SchematicEntity {
|
||||||
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
nbttaglist.func_150309_d(1), nbttaglist.func_150309_d(2));
|
||||||
pos.x += 0.5;
|
pos.x += 0.5;
|
||||||
pos.z += 0.5;
|
pos.z += 0.5;
|
||||||
entityNBT.setTag("Pos", this.newDoubleNBTList(new double[] {pos.x, pos.y, pos.z}));
|
entityNBT.setTag("Pos", this.newDoubleNBTList(pos.x, pos.y, pos.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class GuiUrbanist extends GuiAdvancedInterface {
|
||||||
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||||
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||||
|
|
||||||
if (onInterface(x, x)) {
|
if (onInterface(x, y)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ public final class InterModComms {
|
||||||
BuildCraftTransport.facadeItem.addFacade(
|
BuildCraftTransport.facadeItem.addFacade(
|
||||||
"buildcraft:facade{" + Block.blockRegistry.getNameForObject(block) + "}",
|
"buildcraft:facade{" + Block.blockRegistry.getNameForObject(block) + "}",
|
||||||
modItemStack);
|
modItemStack);
|
||||||
} else {
|
} else if (block != null) {
|
||||||
logRedundantAddFacadeMessage(m, block.toString());
|
logRedundantAddFacadeMessage(m, block.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.network.Packet;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cofh.api.energy.IEnergyHandler;
|
import cofh.api.energy.IEnergyHandler;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.api.core.ISerializable;
|
import buildcraft.api.core.ISerializable;
|
||||||
import buildcraft.core.network.BuildCraftPacket;
|
import buildcraft.core.network.BuildCraftPacket;
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class Version implements Runnable {
|
||||||
|
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
|
|
||||||
return changelog.toArray(new String[0]);
|
return changelog.toArray(new String[changelog.size()]);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class BuildingSlotBlock extends BuildingSlot {
|
||||||
|
|
||||||
public enum Mode {
|
public enum Mode {
|
||||||
ClearIfInvalid, Build
|
ClearIfInvalid, Build
|
||||||
};
|
}
|
||||||
|
|
||||||
public Mode mode = Mode.Build;
|
public Mode mode = Mode.Build;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
package buildcraft.core.builders;
|
package buildcraft.core.builders;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -49,9 +50,7 @@ public class BuildingSlotEntity extends BuildingSlot {
|
||||||
public LinkedList<ItemStack> getRequirements (IBuilderContext context) {
|
public LinkedList<ItemStack> getRequirements (IBuilderContext context) {
|
||||||
LinkedList<ItemStack> results = new LinkedList<ItemStack>();
|
LinkedList<ItemStack> results = new LinkedList<ItemStack>();
|
||||||
|
|
||||||
for (ItemStack s : schematic.storedRequirements) {
|
Collections.addAll(results, schematic.storedRequirements);
|
||||||
results.add(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ public abstract class BuildCraftContainer extends Container {
|
||||||
stackSlot.stackSize = stackSize;
|
stackSlot.stackSize = stackSize;
|
||||||
|
|
||||||
if (stackSlot.stackSize <= 0) {
|
if (stackSlot.stackSize <= 0) {
|
||||||
slot.putStack((ItemStack) null);
|
slot.putStack(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package buildcraft.core.gui.tooltips;
|
package buildcraft.core.gui.tooltips;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.ForwardingList;
|
import com.google.common.collect.ForwardingList;
|
||||||
|
@ -21,16 +22,12 @@ public class ToolTip extends ForwardingList<ToolTipLine> {
|
||||||
|
|
||||||
public ToolTip(ToolTipLine... lines) {
|
public ToolTip(ToolTipLine... lines) {
|
||||||
this.delay = 0;
|
this.delay = 0;
|
||||||
for (ToolTipLine line: lines) {
|
Collections.addAll(delegate, lines);
|
||||||
delegate.add(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToolTip(int delay, ToolTipLine... lines) {
|
public ToolTip(int delay, ToolTipLine... lines) {
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
for (ToolTipLine line: lines) {
|
Collections.addAll(delegate, lines);
|
||||||
delegate.add(line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,7 @@ public abstract class InventoryWrapper implements ISidedInventory {
|
||||||
@Override public void openInventory() { inventory.openInventory(); }
|
@Override public void openInventory() { inventory.openInventory(); }
|
||||||
@Override public void closeInventory() { inventory.closeInventory(); }
|
@Override public void closeInventory() { inventory.closeInventory(); }
|
||||||
@Override public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) { return inventory.isItemValidForSlot(slotIndex, itemstack); }
|
@Override public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) { return inventory.isItemValidForSlot(slotIndex, itemstack); }
|
||||||
@Override public boolean hasCustomInventoryName() { return inventory.hasCustomInventoryName(); };
|
@Override public boolean hasCustomInventoryName() { return inventory.hasCustomInventoryName(); }
|
||||||
|
|
||||||
/* STATIC HELPER */
|
/* STATIC HELPER */
|
||||||
public static ISidedInventory getWrappedInventory(Object inventory) {
|
public static ISidedInventory getWrappedInventory(Object inventory) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the stack matches any one one of the filter stacks.
|
* Returns true if the stack matches any one one of the filter stacks.
|
||||||
|
@ -24,7 +25,10 @@ public class ArrayFluidFilter implements IFluidFilter {
|
||||||
fluids = new Fluid[stacks.length];
|
fluids = new Fluid[stacks.length];
|
||||||
|
|
||||||
for (int i = 0; i < stacks.length; ++i) {
|
for (int i = 0; i < stacks.length; ++i) {
|
||||||
fluids[i] = FluidContainerRegistry.getFluidForFilledItem(stacks[i]).getFluid();
|
FluidStack stack = FluidContainerRegistry.getFluidForFilledItem(stacks[i]);
|
||||||
|
if (stack != null) {
|
||||||
|
fluids[i] = stack.getFluid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class StatementParameterStackFilter extends ArrayStackOrListFilter {
|
||||||
|
|
||||||
for (IStatementParameter s : parameters) {
|
for (IStatementParameter s : parameters) {
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
if (s instanceof StatementParameterItemStack || s instanceof StatementParameterItemStack) {
|
if (s instanceof StatementParameterItemStack) {
|
||||||
tmp.add(s.getItemStack());
|
tmp.add(s.getItemStack());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class PacketCommand extends BuildCraftPacket {
|
||||||
|
|
||||||
public void handle(EntityPlayer player) {
|
public void handle(EntityPlayer player) {
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
ICommandReceiver receiver = (ICommandReceiver) handler.handle(player, stream, player.worldObj);
|
ICommandReceiver receiver = handler.handle(player, stream, player.worldObj);
|
||||||
if (receiver != null) {
|
if (receiver != null) {
|
||||||
receiver.receiveCommand(command, FMLCommonHandler.instance().getEffectiveSide(), player, stream);
|
receiver.receiveCommand(command, FMLCommonHandler.instance().getEffectiveSide(), player, stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
|
||||||
// Item stacks with alternatives consumption
|
// Item stacks with alternatives consumption
|
||||||
|
|
||||||
for (List<ItemStack> requirements : inputItemsWithAlternatives) {
|
for (List<ItemStack> requirements : inputItemsWithAlternatives) {
|
||||||
IStackFilter filter = new ArrayStackFilter(requirements.toArray(new ItemStack[0]));
|
IStackFilter filter = new ArrayStackFilter(requirements.toArray(new ItemStack[requirements.size()]));
|
||||||
int amount = requirements.get(0).stackSize;
|
int amount = requirements.get(0).stackSize;
|
||||||
|
|
||||||
if (consumeItems(crafter, result, filter, amount, preview) != 0) {
|
if (consumeItems(crafter, result, filter, amount, preview) != 0) {
|
||||||
|
|
|
@ -32,12 +32,12 @@ public class IconFlipped implements IIcon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconWidth() {
|
public int getIconWidth() {
|
||||||
return flipU ? -this.getIconWidth() : this.getIconWidth();
|
return flipU ? -this.icon.getIconWidth() : this.icon.getIconWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconHeight() {
|
public int getIconHeight() {
|
||||||
return flipV ? -this.getIconHeight() : this.getIconHeight();
|
return flipV ? -this.icon.getIconHeight() : this.icon.getIconHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -63,9 +63,7 @@ public class RenderingMarkers implements ISimpleBlockRenderingHandler {
|
||||||
double[][] ret = new double[d.length][d[0].length];
|
double[][] ret = new double[d.length][d[0].length];
|
||||||
|
|
||||||
for (int i = 0; i < d.length; ++i) {
|
for (int i = 0; i < d.length; ++i) {
|
||||||
for (int j = 0; j < d[0].length; ++j) {
|
System.arraycopy(d[i], 0, ret[i], 0, d[0].length);
|
||||||
ret[i][j] = d[i][j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -178,8 +178,6 @@ public class RobotRegistry extends WorldSavedData implements IRobotRegistry {
|
||||||
HashSet<ResourceId> resourceSet = (HashSet<ResourceId>) resourcesTakenByRobot.get(robot.getRobotId())
|
HashSet<ResourceId> resourceSet = (HashSet<ResourceId>) resourcesTakenByRobot.get(robot.getRobotId())
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
ResourceId mainId = null;
|
|
||||||
|
|
||||||
for (ResourceId id : resourceSet) {
|
for (ResourceId id : resourceSet) {
|
||||||
release(id);
|
release(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,6 @@ import buildcraft.core.utils.StringUtils;
|
||||||
public class TriggerEnergy extends BCStatement implements ITriggerInternal, ITriggerExternal {
|
public class TriggerEnergy extends BCStatement implements ITriggerInternal, ITriggerExternal {
|
||||||
|
|
||||||
private boolean high;
|
private boolean high;
|
||||||
private IIcon iconEnergyLow;
|
|
||||||
private IIcon iconEnergyHigh;
|
|
||||||
|
|
||||||
public TriggerEnergy(boolean high) {
|
public TriggerEnergy(boolean high) {
|
||||||
super("buildcraft:energyStored" + (high ? "high" : "low"));
|
super("buildcraft:energyStored" + (high ? "high" : "low"));
|
||||||
|
@ -40,7 +38,7 @@ public class TriggerEnergy extends BCStatement implements ITriggerInternal, ITri
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidEnergyHandler(IEnergyHandler handler) {
|
private boolean isValidEnergyHandler(IEnergyHandler handler) {
|
||||||
return handler instanceof IEnergyHandler;
|
return handler != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTriggeredEnergyHandler(IEnergyHandler handler, ForgeDirection side) {
|
private boolean isTriggeredEnergyHandler(IEnergyHandler handler, ForgeDirection side) {
|
||||||
|
|
|
@ -28,7 +28,8 @@ public class TriggerFluidContainer extends BCStatement implements ITriggerExtern
|
||||||
public enum State {
|
public enum State {
|
||||||
|
|
||||||
Empty, Contains, Space, Full
|
Empty, Contains, Space, Full
|
||||||
};
|
}
|
||||||
|
|
||||||
public State state;
|
public State state;
|
||||||
|
|
||||||
public TriggerFluidContainer(State state) {
|
public TriggerFluidContainer(State state) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class TriggerFluidContainerLevel extends BCStatement implements ITriggerE
|
||||||
private TriggerType(float level) {
|
private TriggerType(float level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
public TriggerType type;
|
public TriggerType type;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class TriggerInventory extends BCStatement implements ITriggerExternal {
|
||||||
public enum State {
|
public enum State {
|
||||||
|
|
||||||
Empty, Contains, Space, Full
|
Empty, Contains, Space, Full
|
||||||
};
|
}
|
||||||
|
|
||||||
public State state;
|
public State state;
|
||||||
|
|
||||||
public TriggerInventory(State state) {
|
public TriggerInventory(State state) {
|
||||||
|
|
|
@ -34,7 +34,8 @@ public class TriggerInventoryLevel extends BCStatement implements ITriggerExtern
|
||||||
private TriggerType(float level) {
|
private TriggerType(float level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
public TriggerType type;
|
public TriggerType type;
|
||||||
|
|
||||||
public TriggerInventoryLevel(TriggerType type) {
|
public TriggerInventoryLevel(TriggerType type) {
|
||||||
|
|
|
@ -52,7 +52,8 @@ public final class CraftingHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemNum == 2 && item1.getItem() == item2.getItem()
|
if (itemNum == 2 && item1 != null && item2 != null
|
||||||
|
&& item1.getItem() == item2.getItem()
|
||||||
&& item1.stackSize == 1 && item2.stackSize == 1
|
&& item1.stackSize == 1 && item2.stackSize == 1
|
||||||
&& item1.getItem().isRepairable()) {
|
&& item1.getItem().isRepairable()) {
|
||||||
Item itemBase = item1.getItem();
|
Item itemBase = item1.getItem();
|
||||||
|
|
|
@ -230,8 +230,6 @@ public abstract class TileEngine extends TileBuildCraft implements IPipeConnecti
|
||||||
|
|
||||||
if (!isOrientationValid()) {
|
if (!isOrientationValid()) {
|
||||||
switchOrientation(true);
|
switchOrientation(true);
|
||||||
} else {
|
|
||||||
TileEntity tile = getTile(orientation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class OilPopulate {
|
||||||
|
|
||||||
private enum GenType {
|
private enum GenType {
|
||||||
LARGE, MEDIUM, LAKE, NONE
|
LARGE, MEDIUM, LAKE, NONE
|
||||||
};
|
}
|
||||||
|
|
||||||
private OilPopulate() {
|
private OilPopulate() {
|
||||||
// BuildCraftCore.debugWorldgen = true;
|
// BuildCraftCore.debugWorldgen = true;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TileLaser extends TileBuildCraft implements IHasWork, IControllable
|
||||||
|
|
||||||
laser.iterateTexture();
|
laser.iterateTexture();
|
||||||
|
|
||||||
if (!!worldObj.isRemote) {
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class ActionRobotWorkInArea extends BCStatement implements IActionInterna
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = ((StatementParameterItemStack) slot.parameters[0]).getItemStack();
|
ItemStack stack = slot.parameters[0].getItemStack();
|
||||||
|
|
||||||
if (!(stack.getItem() instanceof ItemMapLocation)) {
|
if (!(stack.getItem() instanceof ItemMapLocation)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1104,10 +1104,6 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPipeRegistered(int key) {
|
|
||||||
return pipes.containsKey(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Pipe<?> createPipe(Item key) {
|
public static Pipe<?> createPipe(Item key) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -571,7 +571,6 @@ public final class Gate implements IGate, IStatementContainer {
|
||||||
|
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
TileEntity tile = pipe.container.getTile(o);
|
TileEntity tile = pipe.container.getTile(o);
|
||||||
Block block = pipe.container.getBlock(o);
|
|
||||||
allTriggers.addAll(StatementManager.getExternalTriggers(o, tile));
|
allTriggers.addAll(StatementManager.getExternalTriggers(o, tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,7 +596,6 @@ public final class Gate implements IGate, IStatementContainer {
|
||||||
|
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
TileEntity tile = pipe.container.getTile(o);
|
TileEntity tile = pipe.container.getTile(o);
|
||||||
Block block = pipe.container.getBlock(o);
|
|
||||||
allActions.addAll(StatementManager.getExternalActions(o, tile));
|
allActions.addAll(StatementManager.getExternalActions(o, tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
public interface IEmeraldPipe extends IFilteredPipe {
|
public interface IEmeraldPipe extends IFilteredPipe {
|
||||||
|
|
||||||
public enum FilterMode {
|
public enum FilterMode {
|
||||||
WHITE_LIST, BLACK_LIST, ROUND_ROBIN;
|
WHITE_LIST, BLACK_LIST, ROUND_ROBIN
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EmeraldPipeSettings {
|
public class EmeraldPipeSettings {
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
||||||
Pipe<?> pipe = BlockGenericPipe.createPipe(this);
|
Pipe<?> pipe = BlockGenericPipe.createPipe(this);
|
||||||
|
|
||||||
if (pipe == null) {
|
if (pipe == null) {
|
||||||
BCLog.logger.log(Level.WARN, "Pipe failed to create during placement at {0},{1},{2}", new Object[]{i, j, k});
|
BCLog.logger.log(Level.WARN, "Pipe failed to create during placement at {0},{1},{2}", i, j, k);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
}
|
}
|
||||||
if (tile instanceof IEnergyReceiver) {
|
if (tile instanceof IEnergyReceiver) {
|
||||||
IEnergyConnection handler = (IEnergyConnection) tile;
|
IEnergyConnection handler = (IEnergyConnection) tile;
|
||||||
if (handler != null && handler.canConnectEnergy(side.getOpposite())) {
|
if (handler.canConnectEnergy(side.getOpposite())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
||||||
if (pipe != null) {
|
if (pipe != null) {
|
||||||
pipe.readFromNBT(nbt);
|
pipe.readFromNBT(nbt);
|
||||||
} else {
|
} else {
|
||||||
BCLog.logger.log(Level.WARN, "Pipe failed to load from NBT at {0},{1},{2}", new Object[]{xCoord, yCoord, zCoord});
|
BCLog.logger.log(Level.WARN, "Pipe failed to load from NBT at {0},{1},{2}", xCoord, yCoord, zCoord);
|
||||||
deletePipe = true;
|
deletePipe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
||||||
this.blockType = getBlockType();
|
this.blockType = getBlockType();
|
||||||
|
|
||||||
if (pipe == null) {
|
if (pipe == null) {
|
||||||
BCLog.logger.log(Level.WARN, "Pipe failed to initialize at {0},{1},{2}, deleting", new Object[]{xCoord, yCoord, zCoord});
|
BCLog.logger.log(Level.WARN, "Pipe failed to initialize at {0},{1},{2}, deleting", xCoord, yCoord, zCoord);
|
||||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,6 @@ public class TravelingItem {
|
||||||
Position motion = new Position(0, 0, 0, output);
|
Position motion = new Position(0, 0, 0, output);
|
||||||
motion.moveForwards(0.1 + getSpeed() * 2F);
|
motion.moveForwards(0.1 + getSpeed() * 2F);
|
||||||
|
|
||||||
ItemStack stack = getItemStack();
|
|
||||||
EntityItem entity = new EntityItem(container.getWorldObj(), xCoord, yCoord, zCoord, getItemStack());
|
EntityItem entity = new EntityItem(container.getWorldObj(), xCoord, yCoord, zCoord, getItemStack());
|
||||||
entity.lifespan = BuildCraftCore.itemLifespan;
|
entity.lifespan = BuildCraftCore.itemLifespan;
|
||||||
entity.delayBeforeCanPickup = 10;
|
entity.delayBeforeCanPickup = 10;
|
||||||
|
|
|
@ -97,5 +97,5 @@ public class ActionIterator implements Iterable<StatementSlot> {
|
||||||
&& pipe.gates[curDir.ordinal()] != null
|
&& pipe.gates[curDir.ordinal()] != null
|
||||||
&& index < pipe.gates[curDir.ordinal()].activeActions.size();
|
&& index < pipe.gates[curDir.ordinal()].activeActions.size();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public final class GateExpansionPulsar extends GateExpansionBuildcraft implement
|
||||||
// one single moment would do the work at the same time. This
|
// one single moment would do the work at the same time. This
|
||||||
// spreads a bit work load. Note, this is not a problem for
|
// spreads a bit work load. Note, this is not a problem for
|
||||||
// existing gates since tick is stored in NBT
|
// existing gates since tick is stored in NBT
|
||||||
tick = (int) Math.random() * PULSE_PERIOD;
|
tick = (int) (Math.random() * PULSE_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -415,7 +415,7 @@ public class ContainerGateInterface extends BuildCraftContainer implements IComm
|
||||||
IStatement statement = null;
|
IStatement statement = null;
|
||||||
|
|
||||||
if (tag != null && tag.length() > 0) {
|
if (tag != null && tag.length() > 0) {
|
||||||
statement = (IStatement) StatementManager.statements.get(tag);
|
statement = StatementManager.statements.get(tag);
|
||||||
}
|
}
|
||||||
gate.setAction(action, statement);
|
gate.setAction(action, statement);
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ public class ContainerGateInterface extends BuildCraftContainer implements IComm
|
||||||
IStatement statement = null;
|
IStatement statement = null;
|
||||||
|
|
||||||
if (tag != null && tag.length() > 0) {
|
if (tag != null && tag.length() > 0) {
|
||||||
statement = (IStatement) StatementManager.statements.get(tag);
|
statement = StatementManager.statements.get(tag);
|
||||||
}
|
}
|
||||||
gate.setTrigger(trigger, statement);
|
gate.setTrigger(trigger, statement);
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParameter(IStatementParameter param, boolean notifyServer) {
|
public void setParameter(IStatementParameter param, boolean notifyServer) {
|
||||||
container.setTriggerParameter(statementSlot.slot, slot, (IStatementParameter) param, notifyServer);
|
container.setTriggerParameter(statementSlot.slot, slot, param, notifyServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParameter(IStatementParameter param, boolean notifyServer) {
|
public void setParameter(IStatementParameter param, boolean notifyServer) {
|
||||||
container.setActionParameter(statementSlot.slot, slot, (IStatementParameter) param, notifyServer);
|
container.setActionParameter(statementSlot.slot, slot, param, notifyServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import buildcraft.transport.PipeIconProvider;
|
||||||
public class PipeItemsEmerald extends PipeItemsWood implements IClientState, IGuiReturnHandler {
|
public class PipeItemsEmerald extends PipeItemsWood implements IClientState, IGuiReturnHandler {
|
||||||
|
|
||||||
public enum FilterMode {
|
public enum FilterMode {
|
||||||
WHITE_LIST, BLACK_LIST, ROUND_ROBIN;
|
WHITE_LIST, BLACK_LIST, ROUND_ROBIN
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EmeraldPipeSettings {
|
public class EmeraldPipeSettings {
|
||||||
|
|
|
@ -14,10 +14,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cofh.api.energy.IEnergyConnection;
|
|
||||||
import cofh.api.energy.IEnergyHandler;
|
import cofh.api.energy.IEnergyHandler;
|
||||||
import cofh.api.energy.IEnergyProvider;
|
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
|
|
|
@ -27,8 +27,6 @@ public class PlugItemRenderer implements IItemRenderer {
|
||||||
// Render StructurePipe
|
// Render StructurePipe
|
||||||
Block block = BuildCraftTransport.genericPipeBlock;
|
Block block = BuildCraftTransport.genericPipeBlock;
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
block = BuildCraftTransport.genericPipeBlock;
|
|
||||||
IIcon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe
|
IIcon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe
|
||||||
|
|
||||||
block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F);
|
block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F);
|
||||||
|
|
|
@ -27,8 +27,6 @@ public class RobotStationItemRenderer implements IItemRenderer {
|
||||||
// Render StructurePipe
|
// Render StructurePipe
|
||||||
Block block = BuildCraftTransport.genericPipeBlock;
|
Block block = BuildCraftTransport.genericPipeBlock;
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
block = BuildCraftTransport.genericPipeBlock;
|
|
||||||
IIcon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeRobotStation.ordinal()); // Structure pipe
|
IIcon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeRobotStation.ordinal()); // Structure pipe
|
||||||
|
|
||||||
block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F);
|
block.setBlockBounds(0.25F, 0.25F, 0.25F, 0.75F, 0.375F, 0.75F);
|
||||||
|
|
|
@ -39,8 +39,6 @@ public class TriggerParameterSignal implements IStatementParameter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon() {
|
public IIcon getIcon() {
|
||||||
int id = 0;
|
|
||||||
|
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class TriggerPipeContents extends BCStatement implements ITriggerInternal
|
||||||
requestsEnergy,
|
requestsEnergy,
|
||||||
tooMuchEnergy;
|
tooMuchEnergy;
|
||||||
public ITriggerInternal trigger;
|
public ITriggerInternal trigger;
|
||||||
};
|
}
|
||||||
|
|
||||||
private PipeContents kind;
|
private PipeContents kind;
|
||||||
|
|
||||||
public TriggerPipeContents(PipeContents kind) {
|
public TriggerPipeContents(PipeContents kind) {
|
||||||
|
|
|
@ -37,8 +37,6 @@ public class StripesHandlerBucket implements IStripesHandler {
|
||||||
if (block == Blocks.air) {
|
if (block == Blocks.air) {
|
||||||
Block underblock = world.getBlock(x, y - 1, z);
|
Block underblock = world.getBlock(x, y - 1, z);
|
||||||
|
|
||||||
boolean rollback = false;
|
|
||||||
|
|
||||||
if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, x, y - 1, z)) {
|
if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, x, y - 1, z)) {
|
||||||
stack.stackSize = 0;
|
stack.stackSize = 0;
|
||||||
pipe.sendItem(emptyBucket, direction.getOpposite());
|
pipe.sendItem(emptyBucket, direction.getOpposite());
|
||||||
|
|
Loading…
Reference in a new issue