diff --git a/buildcraft_resources/assets/buildcraft/lang/en_US.lang b/buildcraft_resources/assets/buildcraft/lang/en_US.lang index b9f013b2..9f8f5c7e 100644 --- a/buildcraft_resources/assets/buildcraft/lang/en_US.lang +++ b/buildcraft_resources/assets/buildcraft/lang/en_US.lang @@ -477,6 +477,8 @@ tip.deprecated=Deprecated tip.filler.excavate.on=Excavate tip.filler.excavate.off=Do Not Excavate +tip.list.matches=Matches + tip.shift.PipeFluidsDiamond=GUI accepts any fluid containers tip.shift.PipeFluidsEmerald=GUI accepts any fluid container tip.shift.PipeItemsClay=Prioritizes machines and chests\nover neighbouring pipes. diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_green.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_mode_copy.png old mode 100755 new mode 100644 similarity index 53% rename from buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_green.png rename to buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_mode_copy.png index a615b101..3a6a4156 Binary files a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_green.png and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_mode_copy.png differ diff --git a/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_mode_edit.png b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_mode_edit.png new file mode 100644 index 00000000..924e975b Binary files /dev/null and b/buildcraft_resources/assets/buildcraftbuilders/textures/blocks/architectBlock/led_mode_edit.png differ diff --git a/buildcraft_resources/changelog/7.1.0 b/buildcraft_resources/changelog/7.1.0 index c1d7fa29..f4b9d37d 100644 --- a/buildcraft_resources/changelog/7.1.0 +++ b/buildcraft_resources/changelog/7.1.0 @@ -8,16 +8,18 @@ Additions: * Clay fluid pipe! The power of insertion applied to liquids. (asie) * Power Adapters! Connect Kinesis Pipes to non-Kinesis pipes. (asie) * New blueprint library GUI, now featuring a scrollbar! (asie) -* New Lists - sort by type, material, or both, and other improvements! (asie) +* New Lists! (asie) + * Sort by type, material, or both! Precise sorting! + * See with a tooltip if an item matches the List! Improvements: +* New power beam display algorithm (asie) * Use integrated server data in singleplayer for certain tiles - back to the smoothness of 1.2.5! (asie) * Rewritten pipe wires - should now propagate more or less instantly. (asie) * Fluid pipe capacity and extraction rate now scales with the base flow multiplier. (asie) * Debugger support for fluid pipes (asie) * Add events for robot interaction and removal (asie) -* Tweaked power beam rendering algorithm (asie) * Rewritten robots request system (hea3ven) * Changed the IRequestProvider api to be independent of robots. * Delivery robots can now carry more than an item at a time. diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index 6e610323..11a7b8c4 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -133,6 +133,7 @@ import buildcraft.core.list.ListMatchHandlerClass; import buildcraft.core.list.ListMatchHandlerFluid; import buildcraft.core.list.ListMatchHandlerOreDictionary; import buildcraft.core.list.ListRegistry; +import buildcraft.core.list.ListTooltipHandler; import buildcraft.core.network.PacketHandlerCore; import buildcraft.core.properties.WorldPropertyIsDirt; import buildcraft.core.properties.WorldPropertyIsFarmland; @@ -382,6 +383,7 @@ public class BuildCraftCore extends BuildCraftMod { FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler()); + MinecraftForge.EVENT_BUS.register(new ListTooltipHandler()); } @Mod.EventHandler diff --git a/common/buildcraft/builders/BlockArchitect.java b/common/buildcraft/builders/BlockArchitect.java index f2a01e3c..4585542d 100644 --- a/common/buildcraft/builders/BlockArchitect.java +++ b/common/buildcraft/builders/BlockArchitect.java @@ -12,18 +12,16 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import buildcraft.BuildCraftBuilders; import buildcraft.core.GuiIds; +import buildcraft.core.internal.ICustomLEDBlock; import buildcraft.core.lib.block.BlockBuildCraft; -public class BlockArchitect extends BlockBuildCraft { - private IIcon[] led; - +public class BlockArchitect extends BlockBuildCraft implements ICustomLEDBlock { public BlockArchitect() { super(Material.iron); setRotatable(true); @@ -68,4 +66,9 @@ public class BlockArchitect extends BlockBuildCraft { public int getLightValue(IBlockAccess world, int x, int y, int z) { return 1; } + + @Override + public String[] getLEDSuffixes() { + return new String[] { "led_red", "led_mode_copy", "led_mode_edit" }; + } } diff --git a/common/buildcraft/builders/TileArchitect.java b/common/buildcraft/builders/TileArchitect.java index 46647c73..9c7a51ba 100644 --- a/common/buildcraft/builders/TileArchitect.java +++ b/common/buildcraft/builders/TileArchitect.java @@ -9,7 +9,6 @@ package buildcraft.builders; import java.util.ArrayList; -import java.util.LinkedList; import io.netty.buffer.ByteBuf; @@ -44,20 +43,23 @@ import buildcraft.core.lib.utils.NetworkUtils; import buildcraft.core.lib.utils.Utils; public class TileArchitect extends TileBuildCraft implements IInventory, IBoxProvider, ICommandReceiver, ILEDProvider { + public enum Mode { + EDIT, COPY + } + public String currentAuthorName = ""; + public Mode mode = Mode.EDIT; public Box box = new Box(); public String name = ""; public BlueprintReadConfiguration readConfiguration = new BlueprintReadConfiguration(); - public LinkedList subLasers = new LinkedList(); - + public ArrayList subLasers = new ArrayList(); public ArrayList subBlueprints = new ArrayList(); private SimpleInventory inv = new SimpleInventory(2, "Architect", 1); - private RecursiveBlueprintReader reader; - private boolean isProcessing; + private boolean clientIsWorking, initialized; public TileArchitect() { box.kind = Kind.BLUE_STRIPES; @@ -68,12 +70,11 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro super.updateEntity(); if (!worldObj.isRemote) { - if (reader != null) { + if (mode == Mode.COPY && reader != null) { reader.iterate(); if (reader.isDone()) { reader = null; - isProcessing = false; sendNetworkUpdate(); } } @@ -84,17 +85,25 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro public void initialize() { super.initialize(); - if (!worldObj.isRemote) { + if (!worldObj.isRemote && !initialized) { if (!box.isInitialized()) { IAreaProvider a = Utils.getNearbyAreaProvider(worldObj, xCoord, yCoord, zCoord); if (a != null) { + mode = Mode.COPY; box.initialize(a); a.removeFromWorld(); sendNetworkUpdate(); + return; + } else { + mode = Mode.EDIT; } + } else { + mode = Mode.COPY; } + initialized = true; + sendNetworkUpdate(); } } @@ -113,7 +122,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro ItemStack result = inv.decrStackSize(i, j); if (i == 0) { - initializeComputing(); + initializeBlueprint(); } return result; @@ -124,7 +133,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro inv.setInventorySlotContents(i, itemstack); if (i == 0) { - initializeComputing(); + initializeBlueprint(); } } @@ -158,6 +167,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro inv.readFromNBT(nbt); + mode = Mode.values()[nbt.getByte("mode")]; name = nbt.getString("name"); currentAuthorName = nbt.getString("lastAuthor"); @@ -186,6 +196,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro inv.writeToNBT(nbt); + nbt.setByte("mode", (byte) mode.ordinal()); nbt.setString("name", name); nbt.setString("lastAuthor", currentAuthorName); @@ -204,15 +215,22 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro nbt.setTag("subBlueprints", subBptList); } + private boolean getIsWorking() { + return mode == Mode.COPY ? reader != null : false; + } + @Override public void writeData(ByteBuf stream) { box.writeData(stream); NetworkUtils.writeUTF(stream, name); - readConfiguration.writeData(stream); - stream.writeBoolean(reader != null); - stream.writeShort(subLasers.size()); - for (LaserData ld: subLasers) { - ld.writeData(stream); + stream.writeBoolean(getIsWorking()); + stream.writeByte(mode.ordinal()); + if (mode == Mode.COPY) { + readConfiguration.writeData(stream); + stream.writeShort(subLasers.size()); + for (LaserData ld: subLasers) { + ld.writeData(stream); + } } } @@ -220,19 +238,18 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro public void readData(ByteBuf stream) { box.readData(stream); name = NetworkUtils.readUTF(stream); - readConfiguration.readData(stream); - boolean newIsProcessing = stream.readBoolean(); - if (newIsProcessing != isProcessing) { - isProcessing = newIsProcessing; - worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); - } + clientIsWorking = stream.readBoolean(); + mode = Mode.values()[stream.readByte()]; - int size = stream.readUnsignedShort(); - subLasers.clear(); - for (int i = 0; i < size; i++) { - LaserData ld = new LaserData(); - ld.readData(stream); - subLasers.add(ld); + if (mode == Mode.COPY) { + readConfiguration.readData(stream); + int size = stream.readUnsignedShort(); + subLasers.clear(); + for (int i = 0; i < size; i++) { + LaserData ld = new LaserData(); + ld.readData(stream); + subLasers.add(ld); + } } } @Override @@ -241,12 +258,14 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro destroy(); } - private void initializeComputing() { + private void initializeBlueprint() { if (getWorldObj().isRemote) { return; } - reader = new RecursiveBlueprintReader(this); + if (mode == Mode.COPY) { + reader = new RecursiveBlueprintReader(this); + } sendNetworkUpdate(); } @@ -299,6 +318,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro } }); } + @Override public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) { if ("setName".equals(command)) { @@ -325,9 +345,10 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro } public void addSubBlueprint(TileEntity sub) { - addSubBlueprint(new BlockIndex(sub)); - - sendNetworkUpdate(); + if (mode == Mode.COPY) { + addSubBlueprint(new BlockIndex(sub)); + sendNetworkUpdate(); + } } private void addSubBlueprint(BlockIndex index) { @@ -348,6 +369,18 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro @Override public int getLEDLevel(int led) { - return (led == 0 ? isProcessing : box != null && box.isInitialized()) ? 15 : 0; + boolean condition = false; + switch (led) { + case 0: + condition = clientIsWorking; + break; + case 1: + condition = mode == Mode.COPY && box != null && box.isInitialized(); + break; + case 2: + condition = mode == Mode.EDIT; + break; + } + return condition ? 15 : 0; } } \ No newline at end of file diff --git a/common/buildcraft/core/internal/ICustomLEDBlock.java b/common/buildcraft/core/internal/ICustomLEDBlock.java new file mode 100644 index 00000000..26f7afbd --- /dev/null +++ b/common/buildcraft/core/internal/ICustomLEDBlock.java @@ -0,0 +1,5 @@ +package buildcraft.core.internal; + +public interface ICustomLEDBlock { + String[] getLEDSuffixes(); +} diff --git a/common/buildcraft/core/lib/utils/AverageInt.java b/common/buildcraft/core/lib/utils/AverageInt.java index 2dd4ceb1..edc53f6b 100644 --- a/common/buildcraft/core/lib/utils/AverageInt.java +++ b/common/buildcraft/core/lib/utils/AverageInt.java @@ -15,6 +15,10 @@ public class AverageInt { public AverageInt(int precise) { this.precise = precise; + clear(); + } + + public void clear() { this.data = new int[precise]; this.pos = 0; } diff --git a/common/buildcraft/core/list/ListMatchHandlerFluid.java b/common/buildcraft/core/list/ListMatchHandlerFluid.java index 2c5b5417..51ea6a18 100644 --- a/common/buildcraft/core/list/ListMatchHandlerFluid.java +++ b/common/buildcraft/core/list/ListMatchHandlerFluid.java @@ -2,18 +2,18 @@ package buildcraft.core.list; import java.util.ArrayList; import java.util.List; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; + import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; + import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.utils.FluidUtils; public class ListMatchHandlerFluid extends ListMatchHandler { @Override public boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise) { - if (type == Type.MATERIAL) { + if (type == Type.TYPE) { if (FluidContainerRegistry.isContainer(stack) && FluidContainerRegistry.isContainer(target)) { ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack); ItemStack emptyContainerTarget = FluidContainerRegistry.drainFluidContainer(target); @@ -21,7 +21,7 @@ public class ListMatchHandlerFluid extends ListMatchHandler { return true; } } - } else if (type == Type.TYPE) { + } else if (type == Type.MATERIAL) { FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack); FluidStack fTarget = FluidUtils.getFluidStackFromItemStack(target); if (fStack != null && fTarget != null) { @@ -33,7 +33,7 @@ public class ListMatchHandlerFluid extends ListMatchHandler { @Override public List getClientExamples(Type type, ItemStack stack) { - if (type == Type.TYPE) { + if (type == Type.MATERIAL) { FluidStack fStack = FluidUtils.getFluidStackFromItemStack(stack); if (fStack != null) { List examples = new ArrayList(); @@ -44,7 +44,7 @@ public class ListMatchHandlerFluid extends ListMatchHandler { } return examples; } - } else if (type == Type.MATERIAL) { + } else if (type == Type.TYPE) { if (FluidContainerRegistry.isContainer(stack)) { List examples = new ArrayList(); ItemStack emptyContainerStack = FluidContainerRegistry.drainFluidContainer(stack); diff --git a/common/buildcraft/core/list/ListTooltipHandler.java b/common/buildcraft/core/list/ListTooltipHandler.java new file mode 100644 index 00000000..70df3938 --- /dev/null +++ b/common/buildcraft/core/list/ListTooltipHandler.java @@ -0,0 +1,23 @@ +package buildcraft.core.list; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +import buildcraft.api.items.IList; +import buildcraft.core.lib.utils.StringUtils; + +public class ListTooltipHandler { + @SubscribeEvent + public void itemTooltipEvent(ItemTooltipEvent event) { + if (event.entityPlayer.openContainer instanceof ContainerListNew) { + ItemStack list = event.entityPlayer.getCurrentEquippedItem(); + if (list != null && list.getItem() instanceof IList) { + if (((IList) list.getItem()).matches(list, event.itemStack)) { + event.toolTip.add(EnumChatFormatting.GREEN + StringUtils.localize("tip.list.matches")); + } + } + } + } +} diff --git a/common/buildcraft/core/render/RenderLEDTile.java b/common/buildcraft/core/render/RenderLEDTile.java index 5fb51442..2b1a7746 100644 --- a/common/buildcraft/core/render/RenderLEDTile.java +++ b/common/buildcraft/core/render/RenderLEDTile.java @@ -1,6 +1,8 @@ package buildcraft.core.render; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.lwjgl.opengl.GL11; @@ -12,6 +14,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; +import buildcraft.core.internal.ICustomLEDBlock; import buildcraft.core.internal.ILEDProvider; import buildcraft.core.lib.block.BlockBuildCraft; import buildcraft.core.lib.render.RenderEntityBlock; @@ -29,12 +32,18 @@ public class RenderLEDTile extends TileEntitySpecialRenderer { public static void registerBlockIcons(IIconRegister register) { for (Block b : iconMap.keySet().toArray(new Block[iconMap.keySet().size()])) { - // TODO (7.1): The count of icons is hardcoded here. Consider adding a better way. String base = ResourceUtils.getObjectPrefix(Block.blockRegistry.getNameForObject(b)); - iconMap.put(b, new IIcon[] { - register.registerIcon(base + "/led_red"), - register.registerIcon(base + "/led_green") - }); + List icons = new ArrayList(); + if (b instanceof ICustomLEDBlock) { + for (String s : ((ICustomLEDBlock) b).getLEDSuffixes()) { + icons.add(register.registerIcon(base + "/" + s)); + } + } else { + icons.add(register.registerIcon(base + "/led_red")); + icons.add(register.registerIcon(base + "/led_green")); + } + + iconMap.put(b, icons.toArray(new IIcon[icons.size()])); } } @@ -58,8 +67,10 @@ public class RenderLEDTile extends TileEntitySpecialRenderer { GL11.glScalef(Z_OFFSET, Z_OFFSET, Z_OFFSET); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - for (int i = 0; i < 2; i++) { - renderBox.texture = iconMap.get(block)[i]; + IIcon[] icons = iconMap.get(block); + + for (int i = 0; i < icons.length; i++) { + renderBox.texture = icons[i]; if (((BlockBuildCraft) block).isRotatable()) { renderBox.setRenderSingleSide(((BlockBuildCraft) block).getFrontSide(tile.getBlockMetadata())); } else { @@ -71,7 +82,9 @@ public class RenderLEDTile extends TileEntitySpecialRenderer { renderBox.renderSide[5] = true; } renderBox.light = provider.getLEDLevel(i); - RenderEntityBlock.INSTANCE.renderBlock(renderBox); + if (renderBox.light > 0) { + RenderEntityBlock.INSTANCE.renderBlock(renderBox); + } } GL11.glPopAttrib(); diff --git a/common/buildcraft/robotics/ai/AIRobotSearchBlock.java b/common/buildcraft/robotics/ai/AIRobotSearchBlock.java index 9e7a4f01..bc756e07 100644 --- a/common/buildcraft/robotics/ai/AIRobotSearchBlock.java +++ b/common/buildcraft/robotics/ai/AIRobotSearchBlock.java @@ -28,6 +28,15 @@ public class AIRobotSearchBlock extends AIRobot { private double maxDistanceToEnd; private IZone zone; + public AIRobotSearchBlock(EntityRobotBase iRobot) { + super(iRobot); + + zone = iRobot.getZoneToWork(); + blockFound = null; + pathFound = null; + path = null; + } + public AIRobotSearchBlock(EntityRobotBase iRobot, boolean random, IBlockFilter iPathFound, double iMaxDistanceToEnd) { super(iRobot); diff --git a/common/buildcraft/transport/PipeTransportPower.java b/common/buildcraft/transport/PipeTransportPower.java index 4d873b1b..b7ddb9d3 100644 --- a/common/buildcraft/transport/PipeTransportPower.java +++ b/common/buildcraft/transport/PipeTransportPower.java @@ -32,6 +32,7 @@ import buildcraft.api.transport.IPipeTile; import buildcraft.core.CompatHooks; import buildcraft.core.DefaultProps; import buildcraft.core.lib.block.TileBuildCraft; +import buildcraft.core.lib.utils.AverageInt; import buildcraft.transport.network.PacketPowerUpdate; import buildcraft.transport.pipes.PipePowerCobblestone; import buildcraft.transport.pipes.PipePowerDiamond; @@ -46,8 +47,7 @@ import buildcraft.transport.pipes.PipePowerWood; public class PipeTransportPower extends PipeTransport implements IDebuggable { public static final Map>, Integer> powerCapacities = new HashMap>, Integer>(); public static final Map>, Float> powerResistances = new HashMap>, Float>(); - - private static final int DISPLAY_SMOOTHING = 10; + private static final int OVERLOAD_TICKS = 60; public short[] displayPower = new short[6]; @@ -61,13 +61,12 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { public int[] dbgEnergyOutput = new int[6]; public int[] dbgEnergyOffered = new int[6]; + private final AverageInt[] powerAverage = new AverageInt[6]; private final TileEntity[] tiles = new TileEntity[6]; private final Object[] providers = new Object[6]; private boolean needsInit = true; - private short[] prevDisplayPower = new short[6]; - private int[] powerQuery = new int[6]; private long currentDate; @@ -78,6 +77,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { public PipeTransportPower() { for (int i = 0; i < 6; ++i) { powerQuery[i] = 0; + powerAverage[i] = new AverageInt(10); } } @@ -159,7 +159,7 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { tiles[o] = null; internalPower[o] = 0; internalNextPower[o] = 0; - displayPower[o] = 0; + powerAverage[o].clear(); } providers[o] = getEnergyProvider(o); } @@ -200,10 +200,6 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { } } - // Send the power to nearby pipes who requested it - System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6); - Arrays.fill(displayPower, (short) 0); - for (int i = 0; i < 6; ++i) { if (internalPower[i] > 0) { int totalPowerQuery = 0; @@ -251,16 +247,17 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable { } } - displayPower[j] += watts; - displayPower[i] += watts; + powerAverage[j].push((int) Math.ceil(watts)); + powerAverage[i].push((int) Math.ceil(watts)); } } } } } - float highestPower = 0.0F; + short highestPower = 0; for (int i = 0; i < 6; i++) { - displayPower[i] = (short) Math.ceil((float) (prevDisplayPower[i] * (DISPLAY_SMOOTHING - 1) + displayPower[i]) / DISPLAY_SMOOTHING); + powerAverage[i].tick(); + displayPower[i] = (short) Math.round(powerAverage[i].getAverage()); if (displayPower[i] > highestPower) { highestPower = displayPower[i]; } diff --git a/common/buildcraft/transport/statements/TriggerPipeContents.java b/common/buildcraft/transport/statements/TriggerPipeContents.java index 1fc5ab1d..f44eec75 100644 --- a/common/buildcraft/transport/statements/TriggerPipeContents.java +++ b/common/buildcraft/transport/statements/TriggerPipeContents.java @@ -111,16 +111,16 @@ public class TriggerPipeContents extends BCStatement implements ITriggerInternal switch (kind) { case empty: - for (double s : transportPower.displayPower) { - if (s > 1e-4) { + for (short s : transportPower.displayPower) { + if (s > 0) { return false; } } return true; case containsEnergy: - for (double s : transportPower.displayPower) { - if (s > 1e-4) { + for (short s : transportPower.displayPower) { + if (s > 0) { return true; } }