From 9f71fdfe0e1ed9578e96d6c6fd1977e4eb8561d2 Mon Sep 17 00:00:00 2001 From: SpaceToad Date: Thu, 4 Sep 2014 20:55:50 +0200 Subject: [PATCH] fixed style --- api/buildcraft/api/power/ILaserTarget.java | 1 + api/buildcraft/api/power/IPowerEmitter.java | 3 +- api/buildcraft/api/power/IPowerReceptor.java | 8 +- api/buildcraft/api/power/PowerHandler.java | 114 +++++++++++------- api/buildcraft/api/power/package-info.java | 4 +- .../api/robots/EntityRobotBase.java | 5 +- .../builders/TileAbstractBuilder.java | 10 +- common/buildcraft/core/RFBattery.java | 53 +++++--- common/buildcraft/core/TileBuildCraft.java | 46 ++++--- .../core/triggers/DefaultTriggerProvider.java | 9 +- .../core/triggers/TriggerEnergy.java | 19 +-- .../buildcraft/energy/TileEnergyEmitter.java | 6 +- .../buildcraft/energy/TileEnergyReceiver.java | 7 +- common/buildcraft/energy/TileEngine.java | 81 ++++++++----- common/buildcraft/energy/TileEngineIron.java | 6 +- common/buildcraft/energy/TileEngineStone.java | 6 +- common/buildcraft/energy/TileEngineWood.java | 13 +- common/buildcraft/energy/gui/GuiEngine.java | 9 +- common/buildcraft/factory/TileMiningWell.java | 5 +- common/buildcraft/factory/TileQuarry.java | 4 +- .../transport/PipeTransportPower.java | 38 +++--- .../transport/PipeTriggerProvider.java | 7 +- .../buildcraft/transport/TileGenericPipe.java | 49 +++++--- .../transport/gates/GateExpansionPulsar.java | 8 +- .../transport/network/PacketPowerUpdate.java | 6 +- .../transport/pipes/PipeFluidsWood.java | 6 +- .../transport/pipes/PipeItemsObsidian.java | 10 +- .../transport/pipes/PipeItemsStripes.java | 16 ++- .../transport/pipes/PipeItemsWood.java | 6 +- .../transport/pipes/PipePowerEmerald.java | 11 +- .../transport/pipes/PipePowerWood.java | 41 ++++--- guidelines/buildcraft.checkstyle | 4 +- guidelines/buildcraft.epf | 12 +- 33 files changed, 393 insertions(+), 230 deletions(-) diff --git a/api/buildcraft/api/power/ILaserTarget.java b/api/buildcraft/api/power/ILaserTarget.java index 8d896cb8..5ae64328 100644 --- a/api/buildcraft/api/power/ILaserTarget.java +++ b/api/buildcraft/api/power/ILaserTarget.java @@ -8,6 +8,7 @@ */ package buildcraft.api.power; +@Deprecated public interface ILaserTarget { /** diff --git a/api/buildcraft/api/power/IPowerEmitter.java b/api/buildcraft/api/power/IPowerEmitter.java index 4bb48497..bdac3e4b 100644 --- a/api/buildcraft/api/power/IPowerEmitter.java +++ b/api/buildcraft/api/power/IPowerEmitter.java @@ -16,7 +16,8 @@ import net.minecraftforge.common.util.ForgeDirection; * This Tile Entity interface allows you to indicate that a block can emit power * from a specific side. */ +@Deprecated public interface IPowerEmitter { - public boolean canEmitPowerFrom(ForgeDirection side); + boolean canEmitPowerFrom(ForgeDirection side); } diff --git a/api/buildcraft/api/power/IPowerReceptor.java b/api/buildcraft/api/power/IPowerReceptor.java index 79586e9e..5240ef74 100644 --- a/api/buildcraft/api/power/IPowerReceptor.java +++ b/api/buildcraft/api/power/IPowerReceptor.java @@ -9,12 +9,14 @@ package buildcraft.api.power; import net.minecraft.world.World; + import net.minecraftforge.common.util.ForgeDirection; /** * This interface should be implemented by any Tile Entity that wishes to be * able to receive power. */ +@Deprecated public interface IPowerReceptor { /** @@ -29,7 +31,7 @@ public interface IPowerReceptor { * @param side * @return */ - public PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side); + PowerHandler.PowerReceiver getPowerReceiver(ForgeDirection side); /** * Call back from the PowerHandler that is called when the stored power @@ -39,7 +41,7 @@ public interface IPowerReceptor { * * @param workProvider */ - public void doWork(PowerHandler workProvider); + void doWork(PowerHandler workProvider); - public World getWorld(); + World getWorld(); } diff --git a/api/buildcraft/api/power/PowerHandler.java b/api/buildcraft/api/power/PowerHandler.java index 8979086e..8ae21ad5 100644 --- a/api/buildcraft/api/power/PowerHandler.java +++ b/api/buildcraft/api/power/PowerHandler.java @@ -8,10 +8,12 @@ */ package buildcraft.api.power; -import buildcraft.api.core.SafeTimeTracker; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.common.util.ForgeDirection; +import buildcraft.api.core.SafeTimeTracker; + /** * The PowerHandler is similar to FluidTank in that it holds your power and * allows standardized interaction between machines. @@ -28,6 +30,7 @@ import net.minecraftforge.common.util.ForgeDirection; * @see IPowerReceptor * @see IPowerEmitter */ +@Deprecated public final class PowerHandler { public static enum Type { @@ -75,11 +78,12 @@ public final class PowerHandler { * * @param powerLoss power loss per tick */ - public PerditionCalculator(double powerLoss) { - if (powerLoss < MIN_POWERLOSS) { + public PerditionCalculator(double iPowerLoss) { + if (iPowerLoss < MIN_POWERLOSS) { + powerLoss = iPowerLoss; + } else { powerLoss = MIN_POWERLOSS; } - this.powerLoss = powerLoss; } /** @@ -93,11 +97,14 @@ public final class PowerHandler { * @return */ public double applyPerdition(PowerHandler powerHandler, double current, long ticksPassed) { - current -= powerLoss * ticksPassed; - if (current < 0) { - current = 0; + double result = current; + + result -= powerLoss * ticksPassed; + if (result < 0) { + result = 0; } - return current; + + return result; } /** @@ -115,6 +122,8 @@ public final class PowerHandler { public static final double ROLLING_AVERAGE_WEIGHT = 100.0; public static final double ROLLING_AVERAGE_NUMERATOR = ROLLING_AVERAGE_WEIGHT - 1; public static final double ROLLING_AVERAGE_DENOMINATOR = 1.0 / ROLLING_AVERAGE_WEIGHT; + public final int[] powerSources = new int[6]; + public final IPowerReceptor receptor; private double minEnergyReceived; private double maxEnergyReceived; private double maxEnergyStored; @@ -123,8 +132,6 @@ public final class PowerHandler { private final SafeTimeTracker doWorkTracker = new SafeTimeTracker(); private final SafeTimeTracker sourcesTracker = new SafeTimeTracker(); private final SafeTimeTracker perditionTracker = new SafeTimeTracker(); - public final int[] powerSources = new int[6]; - public final IPowerReceptor receptor; private PerditionCalculator perdition; private final PowerReceiver receiver; private final Type type; @@ -167,29 +174,38 @@ public final class PowerHandler { /** * Setup your PowerHandler's settings. * - * @param minEnergyReceived This is the minimum about of power that will be - * accepted by the PowerHandler. This should generally be greater than the - * activationEnergy if you plan to use the doWork() callback. Anything - * greater than 1 will prevent Redstone Engines from powering this Provider. - * @param maxEnergyReceived The maximum amount of power accepted by the - * PowerHandler. This should generally be less than 500. Too low and larger - * engines will overheat while trying to power the machine. Too high, and - * the engines will never warm up. Greater values also place greater strain - * on the power net. - * @param activationEnergy If the stored energy is greater than this value, - * the doWork() callback is called (once per tick). - * @param maxStoredEnergy The maximum amount of power this PowerHandler can - * store. Values tend to range between 100 and 5000. With 1000 and 1500 - * being common. + * @param minEnergyReceived + * This is the minimum about of power that will be accepted by + * the PowerHandler. This should generally be greater than the + * activationEnergy if you plan to use the doWork() callback. + * Anything greater than 1 will prevent Redstone Engines from + * powering this Provider. + * @param iMaxEnergyReceived + * The maximum amount of power accepted by the PowerHandler. This + * should generally be less than 500. Too low and larger engines + * will overheat while trying to power the machine. Too high, and + * the engines will never warm up. Greater values also place + * greater strain on the power net. + * @param activationEnergy + * If the stored energy is greater than this value, the doWork() + * callback is called (once per tick). + * @param maxStoredEnergy + * The maximum amount of power this PowerHandler can store. + * Values tend to range between 100 and 5000. With 1000 and 1500 + * being common. */ - public void configure(double minEnergyReceived, double maxEnergyReceived, double activationEnergy, double maxStoredEnergy) { - if (minEnergyReceived > maxEnergyReceived) { - maxEnergyReceived = minEnergyReceived; + public void configure(double iMinEnergyReceived, double iMaxEnergyReceived, double iActivationEnergy, + double iMaxStoredEnergy) { + + if (iMinEnergyReceived > maxEnergyReceived) { + maxEnergyReceived = iMinEnergyReceived; + } else { + maxEnergyReceived = iMaxEnergyReceived; } - this.minEnergyReceived = minEnergyReceived; - this.maxEnergyReceived = maxEnergyReceived; - this.maxEnergyStored = maxStoredEnergy; - this.activationEnergy = activationEnergy; + + minEnergyReceived = iMinEnergyReceived; + maxEnergyStored = iMaxStoredEnergy; + activationEnergy = iActivationEnergy; } /** @@ -217,17 +233,20 @@ public final class PowerHandler { * For example if you want exponentially increasing loss based on amount * stored. * - * @param perdition + * @param iPerdition */ - public void setPerdition(PerditionCalculator perdition) { - if (perdition == null) + public void setPerdition(PerditionCalculator iPerdition) { + if (iPerdition == null) { perdition = DEFAULT_PERDITION; - this.perdition = perdition; + } else { + perdition = iPerdition; + } } public PerditionCalculator getPerdition() { - if (perdition == null) + if (perdition == null) { return DEFAULT_PERDITION; + } return perdition; } @@ -250,10 +269,11 @@ public final class PowerHandler { if (perditionTracker.markTimeIfDelay(receptor.getWorld(), 1) && energyStored > 0) { double prev = energyStored; double newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); - if (newEnergy == 0 || newEnergy < energyStored) + if (newEnergy == 0 || newEnergy < energyStored) { energyStored = newEnergy; - else + } else { energyStored = DEFAULT_PERDITION.applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay()); + } validateEnergy(); averageLostPower = (averageLostPower * ROLLING_AVERAGE_NUMERATOR + (prev - energyStored)) * ROLLING_AVERAGE_DENOMINATOR; @@ -278,8 +298,9 @@ public final class PowerHandler { } } - if (source != null) + if (source != null) { powerSources[source.ordinal()] = 10; + } } /** @@ -312,8 +333,9 @@ public final class PowerHandler { validateEnergy(); - if (doUse) + if (doUse) { averageUsedPower = (averageUsedPower * ROLLING_AVERAGE_NUMERATOR + result) * ROLLING_AVERAGE_DENOMINATOR; + } return result; } @@ -433,20 +455,22 @@ public final class PowerHandler { * * @return the amount the power changed by */ - public double addEnergy(double quantity) { - energyStored += quantity; + public double addEnergy(double iQuantity) { + energyStored += iQuantity; + + double added = iQuantity; if (energyStored > maxEnergyStored) { - quantity -= energyStored - maxEnergyStored; + added -= energyStored - maxEnergyStored; energyStored = maxEnergyStored; } else if (energyStored < 0) { - quantity -= energyStored; + added -= energyStored; energyStored = 0; } applyPerdition(); - return quantity; + return added; } public void setEnergy(double quantity) { diff --git a/api/buildcraft/api/power/package-info.java b/api/buildcraft/api/power/package-info.java index 4a98dbbe..0a95496b 100644 --- a/api/buildcraft/api/power/package-info.java +++ b/api/buildcraft/api/power/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion="1.1",owner="BuildCraftAPI|core",provides="BuildCraftAPI|power") +@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|power") package buildcraft.api.power; -import cpw.mods.fml.common.API; \ No newline at end of file +import cpw.mods.fml.common.API; diff --git a/api/buildcraft/api/robots/EntityRobotBase.java b/api/buildcraft/api/robots/EntityRobotBase.java index 706383cd..4ddc47b3 100755 --- a/api/buildcraft/api/robots/EntityRobotBase.java +++ b/api/buildcraft/api/robots/EntityRobotBase.java @@ -8,13 +8,16 @@ */ package buildcraft.api.robots; -import cofh.api.energy.IEnergyStorage; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; + import net.minecraftforge.fluids.IFluidHandler; + +import cofh.api.energy.IEnergyStorage; + import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.core.IZone; diff --git a/common/buildcraft/builders/TileAbstractBuilder.java b/common/buildcraft/builders/TileAbstractBuilder.java index f2501bbf..c540dda2 100755 --- a/common/buildcraft/builders/TileAbstractBuilder.java +++ b/common/buildcraft/builders/TileAbstractBuilder.java @@ -13,6 +13,7 @@ import java.util.LinkedList; import net.minecraft.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; + import buildcraft.api.blueprints.ITileBuilder; import buildcraft.api.blueprints.SchematicRegistry; import buildcraft.api.core.NetworkData; @@ -71,7 +72,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil super.updateEntity(); RFBattery battery = this.getBattery(); - + if (rfPrev != battery.getEnergyStored()) { rfPrev = battery.getEnergyStored(); rfUnchangedCycles = 0; @@ -123,6 +124,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil buildersInAction.add(item); } + @Override public void addAndLaunchBuildingItem(BuildingItem item) { buildersInAction.add(item); RPCHandler.rpcBroadcastWorldPlayers(worldObj, this, "launchItem", item); @@ -133,7 +135,7 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil } public final boolean consumeEnergy(int quantity) { - return (getBattery().useEnergy(quantity, quantity, false) > 0); + return getBattery().useEnergy(quantity, quantity, false) > 0; } @Override @@ -144,11 +146,11 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil @Override public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); - + rfPrev = getBattery().getEnergyStored(); rfUnchangedCycles = 0; } - + @Override public double getMaxRenderDistanceSquared() { return Double.MAX_VALUE; diff --git a/common/buildcraft/core/RFBattery.java b/common/buildcraft/core/RFBattery.java index 9735bfd1..e76736c9 100644 --- a/common/buildcraft/core/RFBattery.java +++ b/common/buildcraft/core/RFBattery.java @@ -1,27 +1,30 @@ package buildcraft.core; -import cofh.api.energy.IEnergyStorage; import net.minecraft.nbt.NBTTagCompound; +import cofh.api.energy.IEnergyStorage; + public class RFBattery implements IEnergyStorage { private int energy, maxEnergy, maxReceive, maxExtract; - + public RFBattery(int maxEnergy, int maxReceive, int maxExtract) { this.maxEnergy = maxEnergy; this.maxReceive = maxReceive; this.maxExtract = maxExtract; } - + public void readFromNBT(NBTTagCompound tag) { - if(!(tag.hasKey("battery"))) return; - + if (!(tag.hasKey("battery"))) { + return; + } + NBTTagCompound battery = tag.getCompoundTag("battery"); this.energy = battery.getInteger("energy"); this.maxEnergy = battery.getInteger("maxEnergy"); this.maxReceive = battery.getInteger("maxReceive"); this.maxExtract = battery.getInteger("maxExtract"); } - + public void writeToNBT(NBTTagCompound tag) { NBTTagCompound battery = new NBTTagCompound(); battery.setInteger("energy", this.energy); @@ -29,21 +32,35 @@ public class RFBattery implements IEnergyStorage { battery.setInteger("maxReceive", this.maxReceive); battery.setInteger("maxExtract", this.maxExtract); } - + public int addEnergy(int minReceive, int maxReceive, boolean simulate) { int amountReceived = Math.min(maxReceive, maxEnergy - energy); - if (amountReceived < minReceive) return 0; - if (!simulate) energy += amountReceived; + + if (amountReceived < minReceive) { + return 0; + } + + if (!simulate) { + energy += amountReceived; + } + return amountReceived; } public int useEnergy(int minExtract, int maxExtract, boolean simulate) { int amountExtracted = Math.min(maxExtract, energy); - if (amountExtracted < minExtract) return 0; - if (!simulate) energy -= amountExtracted; + + if (amountExtracted < minExtract) { + return 0; + } + + if (!simulate) { + energy -= amountExtracted; + } + return amountExtracted; } - + @Override public int receiveEnergy(int maxReceive, boolean simulate) { return addEnergy(0, Math.min(maxReceive, this.maxReceive), simulate); @@ -63,18 +80,18 @@ public class RFBattery implements IEnergyStorage { public int getMaxEnergyStored() { return maxEnergy; } - + public int getMaxEnergyReceive() { return maxReceive; } - + public int getMaxEnergyExtract() { return maxExtract; } - - public void setEnergy(int energy) { - this.energy = energy; - + + public void setEnergy(int iEnergy) { + energy = iEnergy; + if (energy < 0) { energy = 0; } else if (energy > maxEnergy) { diff --git a/common/buildcraft/core/TileBuildCraft.java b/common/buildcraft/core/TileBuildCraft.java index 1f0d9731..adfa068c 100644 --- a/common/buildcraft/core/TileBuildCraft.java +++ b/common/buildcraft/core/TileBuildCraft.java @@ -12,7 +12,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import cofh.api.energy.IEnergyHandler; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -20,7 +19,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftCore; import buildcraft.api.power.IPowerReceptor; import buildcraft.core.network.BuildCraftPacket; @@ -41,7 +44,7 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized private boolean init = false; private String owner = "[BuildCraft]"; private RFBattery battery; - + public TileBuildCraft() { if (!updateWrappers.containsKey(this.getClass())) { updateWrappers.put(this.getClass(), new TilePacketWrapper(this.getClass())); @@ -54,7 +57,7 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized updatePacket = updateWrappers.get(this.getClass()); descriptionPacket = descriptionWrappers.get(this.getClass()); } - + public String getOwner() { return owner; } @@ -160,41 +163,54 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized public boolean equals(Object cmp) { return this == cmp; } - + + @Override public boolean canConnectEnergy(ForgeDirection from) { - return (battery != null); + return battery != null; } + @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - if(battery != null && this.canConnectEnergy(from)) + if (battery != null && this.canConnectEnergy(from)) { return battery.receiveEnergy(maxReceive, simulate); - else return 0; + } else { + return 0; + } } + @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - if(battery != null && this.canConnectEnergy(from)) + if (battery != null && this.canConnectEnergy(from)) { return battery.extractEnergy(maxExtract, simulate); - else return 0; + } else { + return 0; + } } + @Override public int getEnergyStored(ForgeDirection from) { - if(battery != null && this.canConnectEnergy(from)) + if (battery != null && this.canConnectEnergy(from)) { return battery.getEnergyStored(); - else return 0; + } else { + return 0; + } } + @Override public int getMaxEnergyStored(ForgeDirection from) { - if(battery != null && this.canConnectEnergy(from)) + if (battery != null && this.canConnectEnergy(from)) { return battery.getMaxEnergyStored(); - else return 0; + } else { + return 0; + } } - + public RFBattery getBattery() { return battery; } - + protected void setBattery(RFBattery battery) { this.battery = battery; } diff --git a/common/buildcraft/core/triggers/DefaultTriggerProvider.java b/common/buildcraft/core/triggers/DefaultTriggerProvider.java index 0005cc66..f671be4d 100644 --- a/common/buildcraft/core/triggers/DefaultTriggerProvider.java +++ b/common/buildcraft/core/triggers/DefaultTriggerProvider.java @@ -10,13 +10,16 @@ package buildcraft.core.triggers; import java.util.LinkedList; -import cofh.api.energy.IEnergyHandler; import net.minecraft.block.Block; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftCore; import buildcraft.api.gates.IOverrideDefaultTriggers; import buildcraft.api.gates.ITrigger; @@ -61,8 +64,8 @@ public class DefaultTriggerProvider implements ITriggerProvider { res.add(BuildCraftCore.triggerMachineActive); res.add(BuildCraftCore.triggerMachineInactive); } - - if (tile instanceof IEnergyHandler && ((IEnergyHandler)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN) > 0) { + + if (tile instanceof IEnergyHandler && ((IEnergyHandler) tile).getMaxEnergyStored(ForgeDirection.UNKNOWN) > 0) { res.add(BuildCraftCore.triggerEnergyHigh); res.add(BuildCraftCore.triggerEnergyLow); } diff --git a/common/buildcraft/core/triggers/TriggerEnergy.java b/common/buildcraft/core/triggers/TriggerEnergy.java index f10d9dc5..cc5f6a33 100755 --- a/common/buildcraft/core/triggers/TriggerEnergy.java +++ b/common/buildcraft/core/triggers/TriggerEnergy.java @@ -8,13 +8,17 @@ */ package buildcraft.core.triggers; -import cofh.api.energy.IEnergyHandler; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.api.gates.IGate; import buildcraft.api.gates.ITriggerParameter; import buildcraft.core.utils.StringUtils; @@ -39,11 +43,11 @@ public class TriggerEnergy extends BCTrigger { private boolean isValidEnergyHandler(IEnergyHandler handler) { return handler.getMaxEnergyStored(ForgeDirection.UNKNOWN) > 0; } - + private boolean isTriggeredEnergyHandler(IEnergyHandler handler) { int energyStored = handler.getEnergyStored(ForgeDirection.UNKNOWN); int energyMaxStored = handler.getMaxEnergyStored(ForgeDirection.UNKNOWN); - + if (energyMaxStored > 0) { if (high) { return (energyStored / energyMaxStored) > 0.95; @@ -56,8 +60,9 @@ public class TriggerEnergy extends BCTrigger { @Override public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) { if (gate.getPipe() instanceof IEnergyHandler) { - if(isValidEnergyHandler((IEnergyHandler)gate.getPipe())) - return isTriggeredEnergyHandler((IEnergyHandler)gate.getPipe()); + if (isValidEnergyHandler((IEnergyHandler) gate.getPipe())) { + return isTriggeredEnergyHandler((IEnergyHandler) gate.getPipe()); + } } // if the pipe can't set the trigger one way or the other, then look @@ -68,10 +73,10 @@ public class TriggerEnergy extends BCTrigger { @Override public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) { - if(tile instanceof IEnergyHandler) { + if (tile instanceof IEnergyHandler) { // Since we return false upon the trigger being invalid anyway, // we can skip the isValidEnergyHandler(...) check. - return isTriggeredEnergyHandler((IEnergyHandler)tile); + return isTriggeredEnergyHandler((IEnergyHandler) tile); } return false; diff --git a/common/buildcraft/energy/TileEnergyEmitter.java b/common/buildcraft/energy/TileEnergyEmitter.java index 9252dbc5..70ef5441 100755 --- a/common/buildcraft/energy/TileEnergyEmitter.java +++ b/common/buildcraft/energy/TileEnergyEmitter.java @@ -13,6 +13,7 @@ import java.util.TreeMap; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; + import buildcraft.api.core.BlockIndex; import buildcraft.api.core.SafeTimeTracker; import buildcraft.core.LaserData; @@ -63,7 +64,7 @@ public class TileEnergyEmitter extends TileBuildCraft { if (t.data.wavePosition > t.data.renderSize) { t.data.wavePosition = 0; - t.data.waveSize = (float) (getBattery().getEnergyStored() / targets.size() / 100F); + t.data.waveSize = getBattery().getEnergyStored() / targets.size() / 100F; if (t.data.waveSize > 1) { t.data.waveSize = 1F; @@ -123,7 +124,8 @@ public class TileEnergyEmitter extends TileBuildCraft { } } } else { - int perTargetEnergy = (int)Math.floor(getBattery().useEnergy(targets.size(), targets.size() * 100, false) / targets.size()); + int perTargetEnergy = (int) Math.floor(getBattery().useEnergy(targets.size(), targets.size() * 100, false) + / targets.size()); for (Target t : targets.values()) { if (!t.data.isVisible) { diff --git a/common/buildcraft/energy/TileEnergyReceiver.java b/common/buildcraft/energy/TileEnergyReceiver.java index 151f4dfb..3c786df6 100755 --- a/common/buildcraft/energy/TileEnergyReceiver.java +++ b/common/buildcraft/energy/TileEnergyReceiver.java @@ -10,9 +10,12 @@ package buildcraft.energy; import java.util.LinkedList; -import cofh.api.energy.IEnergyHandler; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.api.power.IPowerEmitter; import buildcraft.api.power.IPowerReceptor; import buildcraft.api.power.PowerHandler; @@ -71,7 +74,7 @@ public class TileEnergyReceiver extends TileBuildCraft implements IPipeConnectio energyStored = 0; } } else if (tile instanceof IEnergyHandler) { - int energyUsed = ((IEnergyHandler)tile).receiveEnergy(s.getOpposite(), energyStored, false); + int energyUsed = ((IEnergyHandler) tile).receiveEnergy(s.getOpposite(), energyStored, false); energyStored -= energyUsed; } } diff --git a/common/buildcraft/energy/TileEngine.java b/common/buildcraft/energy/TileEngine.java index f139129e..6e2acde7 100644 --- a/common/buildcraft/energy/TileEngine.java +++ b/common/buildcraft/energy/TileEngine.java @@ -10,13 +10,16 @@ package buildcraft.energy; import java.util.LinkedList; -import cofh.api.energy.IEnergyHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ICrafting; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftEnergy; import buildcraft.api.core.NetworkData; import buildcraft.api.gates.IOverrideDefaultTriggers; @@ -34,9 +37,8 @@ import buildcraft.core.TileBuffer; import buildcraft.core.TileBuildCraft; import buildcraft.energy.gui.ContainerEngine; -public abstract class TileEngine extends TileBuildCraft implements IPowerReceptor, IPowerEmitter, IOverrideDefaultTriggers, IPipeConnection, IEnergyHandler { - protected boolean constantPower = false; - +public abstract class TileEngine extends TileBuildCraft implements IPowerReceptor, IPowerEmitter, + IOverrideDefaultTriggers, IPipeConnection, IEnergyHandler { // Index corresponds to metadata public static final ResourceLocation[] BASE_TEXTURES = new ResourceLocation[]{ new ResourceLocation(DefaultProps.TEXTURE_PATH_BLOCKS + "/base_wood.png"), @@ -84,6 +86,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto @NetworkData public ForgeDirection orientation = ForgeDirection.UP; + protected boolean constantPower = false; protected int progressPart = 0; protected boolean lastPower = false; protected PowerHandler powerHandler; @@ -239,8 +242,9 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto if (progress > 0.5 && progressPart == 1) { progressPart = 2; - if(!constantPower) + if (!constantPower) { sendPower(); + } } else if (progress >= 1) { progress = 0; progressPart = 0; @@ -263,26 +267,28 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto } // Uncomment for constant power - if(constantPower) { + if (constantPower) { if (isRedstonePowered && isActive()) { sendPower(); - } else currentOutput = 0; + } else { + currentOutput = 0; + } } - + burn(); } private double getPowerToExtract() { TileEntity tile = getTileBuffer(orientation).getTile(); - if(tile instanceof IEnergyHandler) { - IEnergyHandler handler = ((IEnergyHandler)tile); - + if (tile instanceof IEnergyHandler) { + IEnergyHandler handler = (IEnergyHandler) tile; + int minEnergy = 0; int maxEnergy = handler.receiveEnergy( orientation.getOpposite(), - (int)Math.round(this.energy * 10), true); - return extractEnergy((double)minEnergy / 10.0, (double)maxEnergy / 10.0, false); + (int) Math.round(this.energy * 10), true); + return extractEnergy(minEnergy / 10.0, maxEnergy / 10.0, false); } else if (tile instanceof IPowerReceptor) { PowerReceiver receptor = ((IPowerReceptor) tile) .getPowerReceiver(orientation.getOpposite()); @@ -298,17 +304,20 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto TileEntity tile = getTileBuffer(orientation).getTile(); if (isPoweredTile(tile, orientation)) { double extracted = getPowerToExtract(); - if(extracted > 0) setPumping(true); - else setPumping(false); - + if (extracted > 0) { + setPumping(true); + } else { + setPumping(false); + } + if (tile instanceof IEnergyHandler) { - IEnergyHandler handler = ((IEnergyHandler) tile); + IEnergyHandler handler = (IEnergyHandler) tile; if (Math.round(extracted * 10) > 0) { int neededRF = handler.receiveEnergy( orientation.getOpposite(), - (int)Math.round(extracted * 10), false); - - extractEnergy(0.0, (double)neededRF / 10.0, true); + (int) Math.round(extracted * 10), false); + + extractEnergy(0.0, neededRF / 10.0, true); } } else if (tile instanceof IPowerReceptor) { PowerReceiver receptor = ((IPowerReceptor) tile) @@ -377,11 +386,14 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto TileEntity tile = getTileBuffer(o).getTile(); if ((!pipesOnly || tile instanceof IPipeTile) && isPoweredTile(tile, o)) { - if((tile instanceof IPipeTile) && (((IPipeTile)tile).getPipeType() != PipeType.POWER)) - constantPower = false; - else if(tile instanceof IEnergyHandler) constantPower = true; - else constantPower = false; - + if ((tile instanceof IPipeTile) && (((IPipeTile) tile).getPipeType() != PipeType.POWER)) { + constantPower = false; + } else if (tile instanceof IEnergyHandler) { + constantPower = true; + } else { + constantPower = false; + } + orientation = o; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); @@ -423,8 +435,9 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto progress = data.getFloat("progress"); energy = data.getDouble("energy"); heat = data.getFloat("heat"); - if(data.hasKey("constantPower")) + if (data.hasKey("constantPower")) { constantPower = data.getBoolean("constantPower"); + } } @Override @@ -537,7 +550,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto return false; } else if (tile instanceof IPowerReceptor) { return ((IPowerReceptor) tile).getPowerReceiver(side.getOpposite()) != null; - } else if (tile instanceof IEnergyHandler){ + } else if (tile instanceof IEnergyHandler) { return ((IEnergyHandler) tile).canConnectEnergy(side.getOpposite()); } else { return false; @@ -593,7 +606,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto public void checkRedstonePower() { isRedstonePowered = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); } - + // RF support @Override @@ -606,9 +619,9 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { return 0; - + /*if(!(from == orientation)) return 0; - + int energyRF = (int)Math.round(10 * energy); int energyExtracted = Math.min(maxExtract, energyRF); if(!simulate) { @@ -620,9 +633,11 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto @Override public int getEnergyStored(ForgeDirection from) { - if(!(from == orientation)) return 0; - - return (int)Math.round(10 * energy); + if (!(from == orientation)) { + return 0; + } + + return (int) Math.round(10 * energy); } @Override diff --git a/common/buildcraft/energy/TileEngineIron.java b/common/buildcraft/energy/TileEngineIron.java index b1b3384f..dbb39760 100644 --- a/common/buildcraft/energy/TileEngineIron.java +++ b/common/buildcraft/energy/TileEngineIron.java @@ -173,7 +173,11 @@ public class TileEngineIron extends TileEngineWithInventory implements IFluidHan return; } } - if(!this.constantPower) currentOutput = currentFuel.powerPerCycle; + + if (!this.constantPower) { + currentOutput = currentFuel.powerPerCycle; + } + addEnergy(currentFuel.powerPerCycle); heat += currentFuel.powerPerCycle * HEAT_PER_MJ * getBiomeTempScalar(); } diff --git a/common/buildcraft/energy/TileEngineStone.java b/common/buildcraft/energy/TileEngineStone.java index 84a977d9..0c36f106 100644 --- a/common/buildcraft/energy/TileEngineStone.java +++ b/common/buildcraft/energy/TileEngineStone.java @@ -77,7 +77,11 @@ public class TileEngineStone extends TileEngineWithInventory { burnTime--; double output = getCurrentOutput(); - if(!constantPower) currentOutput = output; // Comment out for constant power + + if (!constantPower) { + currentOutput = output; // Comment out for constant power + } + addEnergy(output); } diff --git a/common/buildcraft/energy/TileEngineWood.java b/common/buildcraft/energy/TileEngineWood.java index c17349e1..51c3e9df 100644 --- a/common/buildcraft/energy/TileEngineWood.java +++ b/common/buildcraft/energy/TileEngineWood.java @@ -10,7 +10,9 @@ package buildcraft.energy; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.common.util.ForgeDirection; + import buildcraft.api.power.PowerHandler; import buildcraft.api.transport.IPipeTile.PipeType; import buildcraft.transport.TileGenericPipe; @@ -96,7 +98,7 @@ public class TileEngineWood extends TileEngine { public boolean isBurning() { return isRedstonePowered; } - + @Override public double getMaxEnergy() { return 100; @@ -111,19 +113,20 @@ public class TileEngineWood extends TileEngine { public double maxEnergyExtracted() { return 1 + PowerHandler.PerditionCalculator.MIN_POWERLOSS; } - + // TODO: HACK @Override public boolean canConnectEnergy(ForgeDirection from) { return false; } - + @Override protected void sendPower() { TileEntity tile = getTileBuffer(orientation).getTile(); - if(tile instanceof TileGenericPipe && ((TileGenericPipe)tile).getPipeType() != PipeType.POWER) + if (tile instanceof TileGenericPipe && ((TileGenericPipe) tile).getPipeType() != PipeType.POWER) { super.sendPower(); - else // pretend we're sending out our powers + } else { // pretend we're sending out our powers this.energy = 0.0; + } } } diff --git a/common/buildcraft/energy/gui/GuiEngine.java b/common/buildcraft/energy/gui/GuiEngine.java index 464f30e9..d6ce8f37 100644 --- a/common/buildcraft/energy/gui/GuiEngine.java +++ b/common/buildcraft/energy/gui/GuiEngine.java @@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; + import buildcraft.BuildCraftCore; import buildcraft.core.CoreIconProvider; import buildcraft.core.gui.BuildCraftContainer; @@ -52,9 +53,11 @@ public abstract class GuiEngine extends GuiBuildCraft { fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour); fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.currentOutput") + ":", x + 22, y + 20, subheaderColour); - fontRendererObj.drawString(String.format("%d RF/t", (int)Math.round(engine.getCurrentOutput() * 10)), x + 22, y + 32, textColour); + fontRendererObj.drawString(String.format("%d RF/t", (int) Math.round(engine.getCurrentOutput() * 10)), + x + 22, y + 32, textColour); fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour); - fontRendererObj.drawString(String.format("%d RF", (int)Math.round(engine.getEnergyStored() * 10)), x + 22, y + 56, textColour); + fontRendererObj.drawString(String.format("%d RF", (int) Math.round(engine.getEnergyStored() * 10)), x + 22, + y + 56, textColour); fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.heat") + ":", x + 22, y + 68, subheaderColour); fontRendererObj.drawString(String.format("%.2f \u00B0C", engine.getHeat()), x + 22, y + 80, textColour); @@ -62,7 +65,7 @@ public abstract class GuiEngine extends GuiBuildCraft { @Override public String getTooltip() { - return String.format("%d RF/t", (int)Math.round(engine.getCurrentOutput() * 10)); + return String.format("%d RF/t", (int) Math.round(engine.getCurrentOutput() * 10)); } } diff --git a/common/buildcraft/factory/TileMiningWell.java b/common/buildcraft/factory/TileMiningWell.java index aaa69ba8..29ad2e60 100644 --- a/common/buildcraft/factory/TileMiningWell.java +++ b/common/buildcraft/factory/TileMiningWell.java @@ -14,7 +14,9 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.util.ForgeDirection; + import buildcraft.BuildCraftCore; import buildcraft.BuildCraftFactory; import buildcraft.api.gates.IAction; @@ -43,7 +45,8 @@ public class TileMiningWell extends TileBuildCraft implements IMachine { return; } - int miningCost = (int)Math.ceil(BuildCraftFactory.MINING_RF_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier); + int miningCost = (int) Math.ceil(BuildCraftFactory.MINING_RF_COST_PER_BLOCK + * BuildCraftFactory.miningMultiplier); if (getBattery().useEnergy(miningCost, miningCost, false) == 0) { return; diff --git a/common/buildcraft/factory/TileQuarry.java b/common/buildcraft/factory/TileQuarry.java index 2dde387b..520a3150 100644 --- a/common/buildcraft/factory/TileQuarry.java +++ b/common/buildcraft/factory/TileQuarry.java @@ -176,7 +176,7 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine { } else if (stage == Stage.IDLE) { dig(); } else if (stage == Stage.DIGGING) { - int energyToUse = 20 + (int)Math.round(getBattery().getEnergyStored() / 500); + int energyToUse = 20 + Math.round(getBattery().getEnergyStored() / 500); if (this.consumeEnergy(energyToUse)) { speed = 0.1 + energyToUse / 200F; @@ -192,7 +192,7 @@ public class TileQuarry extends TileAbstractBuilder implements IMachine { } protected void dig() { - int rf = (int)Math.ceil(BuildCraftFactory.MINING_RF_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier); + int rf = (int) Math.ceil(BuildCraftFactory.MINING_RF_COST_PER_BLOCK * BuildCraftFactory.miningMultiplier); if (!consumeEnergy(rf)) { return; diff --git a/common/buildcraft/transport/PipeTransportPower.java b/common/buildcraft/transport/PipeTransportPower.java index 7d11c512..c087298a 100644 --- a/common/buildcraft/transport/PipeTransportPower.java +++ b/common/buildcraft/transport/PipeTransportPower.java @@ -12,10 +12,13 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import cofh.api.energy.IEnergyHandler; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; import buildcraft.api.core.SafeTimeTracker; @@ -100,9 +103,9 @@ public class PipeTransportPower extends PipeTransport { return true; } } - + if (tile instanceof IEnergyHandler) { - IEnergyHandler handler = (IEnergyHandler)tile; + IEnergyHandler handler = (IEnergyHandler) tile; if (handler != null && handler.canConnectEnergy(side.getOpposite())) { return true; } @@ -165,7 +168,7 @@ public class PipeTransportPower extends PipeTransport { // Send the power to nearby pipes who requested it System.arraycopy(displayPower, 0, prevDisplayPower, 0, 6); - Arrays.fill(displayPower, (short)0); + Arrays.fill(displayPower, (short) 0); // STEP 1 - computes the total amount of power contained and total // amount of power queried @@ -194,7 +197,8 @@ public class PipeTransportPower extends PipeTransport { externalPower[out] = 0; if (powerQuery[out] > 0 && internalPower[out] == 0) { - int powerConsumed = (int)Math.floor((double)(powerQuery[out] * totalPowerContained) / totalPowerQuery); + int powerConsumed = (int) Math.floor((double) (powerQuery[out] * totalPowerContained) + / totalPowerQuery); boolean tilePowered = false; if (tiles[out] instanceof TileGenericPipe) { @@ -207,11 +211,11 @@ public class PipeTransportPower extends PipeTransport { powerConsumed); tilePowered = true; } else if (tiles[out] instanceof IEnergyHandler) { - IEnergyHandler handler = (IEnergyHandler)tiles[out]; - + IEnergyHandler handler = (IEnergyHandler) tiles[out]; + if (handler.canConnectEnergy(ForgeDirection.VALID_DIRECTIONS[out].getOpposite())) { // Transmit power to an RF energy handler - + powerConsumed = handler.receiveEnergy(ForgeDirection.VALID_DIRECTIONS[out].getOpposite(), powerConsumed, false); tilePowered = true; @@ -222,7 +226,7 @@ public class PipeTransportPower extends PipeTransport { if (prov != null) { // Transmit power to the legacy power framework - powerConsumed = (int)Math.ceil(prov.receiveEnergy(Type.PIPE, (double)powerConsumed / 10.0, + powerConsumed = (int) Math.ceil(prov.receiveEnergy(Type.PIPE, powerConsumed / 10.0, ForgeDirection.VALID_DIRECTIONS[out].getOpposite()) * 10); tilePowered = true; } @@ -243,7 +247,7 @@ public class PipeTransportPower extends PipeTransport { if (totalPowerConsumed > 0) { for (int in = 0; in < 6; ++in) { - int powerConsumed = (int)Math.floor(internalPower[in] / totalPowerContained * totalPowerConsumed); + int powerConsumed = (int) Math.floor(internalPower[in] / totalPowerContained * totalPowerConsumed); displayPower[in] += powerConsumed; } } @@ -252,7 +256,7 @@ public class PipeTransportPower extends PipeTransport { highestPower = 0; for (int i = 0; i < 6; i++) { - displayPower[i] = (short)((prevDisplayPower[i] * (DISPLAY_SMOOTHING - 1.0F) + displayPower[i]) / DISPLAY_SMOOTHING); + displayPower[i] = (short) ((prevDisplayPower[i] * (DISPLAY_SMOOTHING - 1.0F) + displayPower[i]) / DISPLAY_SMOOTHING); if (displayPower[i] > highestPower) { highestPower = displayPower[i]; @@ -276,10 +280,10 @@ public class PipeTransportPower extends PipeTransport { for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { TileEntity tile = tiles [dir.ordinal()]; if (tile instanceof IEnergyHandler) { - IEnergyHandler handler = (IEnergyHandler)tile; - if(handler.canConnectEnergy(dir.getOpposite())) { + IEnergyHandler handler = (IEnergyHandler) tile; + if (handler.canConnectEnergy(dir.getOpposite())) { int request = handler.receiveEnergy(dir.getOpposite(), this.maxPower, true); - + if (request > 0) { requestEnergy(dir, request); } @@ -287,7 +291,7 @@ public class PipeTransportPower extends PipeTransport { } else if (!(tile instanceof TileGenericPipe && ((TileGenericPipe) tile).pipe.transport instanceof PipeTransportPower)) { PowerReceiver prov = getReceiverOnSide(dir); if (prov != null) { - int request = (int)Math.floor(prov.powerRequest() * 10); + int request = (int) Math.floor(prov.powerRequest() * 10); if (request > 0) { requestEnergy(dir, request); @@ -297,7 +301,7 @@ public class PipeTransportPower extends PipeTransport { } // Sum the amount of energy requested on each side - + int[] transferQuery = new int[6]; for (int i = 0; i < 6; ++i) { @@ -519,7 +523,7 @@ public class PipeTransportPower extends PipeTransport { public int consumePower(ForgeDirection dir, int max) { int result; - + if (externalPower[dir.ordinal()] < max) { result = externalPower[dir.ordinal()]; } else { diff --git a/common/buildcraft/transport/PipeTriggerProvider.java b/common/buildcraft/transport/PipeTriggerProvider.java index 8f716303..e610dbd4 100644 --- a/common/buildcraft/transport/PipeTriggerProvider.java +++ b/common/buildcraft/transport/PipeTriggerProvider.java @@ -10,10 +10,13 @@ package buildcraft.transport; import java.util.LinkedList; -import cofh.api.energy.IEnergyHandler; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftCore; import buildcraft.api.gates.IOverrideDefaultTriggers; import buildcraft.api.gates.ITrigger; @@ -63,7 +66,7 @@ public class PipeTriggerProvider implements ITriggerProvider { break; } - if (tile instanceof IEnergyHandler && ((IEnergyHandler)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN) > 0) { + if (tile instanceof IEnergyHandler && ((IEnergyHandler) tile).getMaxEnergyStored(ForgeDirection.UNKNOWN) > 0) { result.add(BuildCraftCore.triggerEnergyHigh); result.add(BuildCraftCore.triggerEnergyLow); } diff --git a/common/buildcraft/transport/TileGenericPipe.java b/common/buildcraft/transport/TileGenericPipe.java index 6d5fd6fc..c3bcf452 100755 --- a/common/buildcraft/transport/TileGenericPipe.java +++ b/common/buildcraft/transport/TileGenericPipe.java @@ -12,8 +12,8 @@ import java.util.LinkedList; import org.apache.logging.log4j.Level; -import cofh.api.energy.IEnergyHandler; import io.netty.buffer.ByteBuf; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -24,14 +24,19 @@ import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.WorldServer; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftCore; import buildcraft.BuildCraftTransport; import buildcraft.api.core.BCLog; @@ -1111,41 +1116,51 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui ((IPowerReceptor) pipe).doWork(workProvider); } } - + @Override public boolean canConnectEnergy(ForgeDirection from) { - if(pipe instanceof IEnergyHandler) { - return ((IEnergyHandler)pipe).canConnectEnergy(from); - } else return false; + if (pipe instanceof IEnergyHandler) { + return ((IEnergyHandler) pipe).canConnectEnergy(from); + } else { + return false; + } } @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - if(pipe instanceof IEnergyHandler) { - return ((IEnergyHandler)pipe).receiveEnergy(from, maxReceive, simulate); - } else return 0; + if (pipe instanceof IEnergyHandler) { + return ((IEnergyHandler) pipe).receiveEnergy(from, maxReceive, simulate); + } else { + return 0; + } } @Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - if(pipe instanceof IEnergyHandler) { - return ((IEnergyHandler)pipe).extractEnergy(from, maxExtract, simulate); - } else return 0; + if (pipe instanceof IEnergyHandler) { + return ((IEnergyHandler) pipe).extractEnergy(from, maxExtract, simulate); + } else { + return 0; + } } @Override public int getEnergyStored(ForgeDirection from) { - if(pipe instanceof IEnergyHandler) { - return ((IEnergyHandler)pipe).getEnergyStored(from); - } else return 0; + if (pipe instanceof IEnergyHandler) { + return ((IEnergyHandler) pipe).getEnergyStored(from); + } else { + return 0; + } } @Override public int getMaxEnergyStored(ForgeDirection from) { - if(pipe instanceof IEnergyHandler) { - return ((IEnergyHandler)pipe).getMaxEnergyStored(from); - } else return 0; + if (pipe instanceof IEnergyHandler) { + return ((IEnergyHandler) pipe).getMaxEnergyStored(from); + } else { + return 0; + } } } diff --git a/common/buildcraft/transport/gates/GateExpansionPulsar.java b/common/buildcraft/transport/gates/GateExpansionPulsar.java index a22b6322..d367022f 100644 --- a/common/buildcraft/transport/gates/GateExpansionPulsar.java +++ b/common/buildcraft/transport/gates/GateExpansionPulsar.java @@ -10,10 +10,13 @@ package buildcraft.transport.gates; import java.util.List; -import cofh.api.energy.IEnergyHandler; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftTransport; import buildcraft.api.gates.GateExpansionController; import buildcraft.api.gates.IAction; @@ -100,7 +103,8 @@ public final class GateExpansionPulsar extends GateExpansionBuildcraft implement // TODO: (1 - 1) is coming from pulse count, which has been // removed. The add energy algorithm probably needs to be // reviewed altogether. - ((IEnergyHandler)pipeTile).receiveEnergy(ForgeDirection.UNKNOWN, Math.min(1 << (1 - 1), 64) * 10, false); + ((IEnergyHandler) pipeTile).receiveEnergy(ForgeDirection.UNKNOWN, Math.min(1 << (1 - 1), 64) * 10, + false); hasPulsed = true; } else { gate.setPulsing(true); diff --git a/common/buildcraft/transport/network/PacketPowerUpdate.java b/common/buildcraft/transport/network/PacketPowerUpdate.java index 3fbe569d..3c7b83a0 100644 --- a/common/buildcraft/transport/network/PacketPowerUpdate.java +++ b/common/buildcraft/transport/network/PacketPowerUpdate.java @@ -9,6 +9,7 @@ package buildcraft.transport.network; import io.netty.buffer.ByteBuf; + import buildcraft.core.network.PacketCoordinates; import buildcraft.core.network.PacketIds; import buildcraft.transport.render.PipeRendererTESR; @@ -26,7 +27,7 @@ public class PacketPowerUpdate extends PacketCoordinates { } @Override - public void readData(ByteBuf data) { + public void readData(ByteBuf data) { super.readData(data); displayPower = new short[] { 0, 0, 0, 0, 0, 0 }; overload = data.readBoolean(); @@ -40,7 +41,8 @@ public class PacketPowerUpdate extends PacketCoordinates { super.writeData(data); data.writeBoolean(overload); for (short element : displayPower) { - data.writeByte(Math.min(PipeRendererTESR.POWER_STAGES, (int)Math.ceil(element * PipeRendererTESR.DISPLAY_MULTIPLIER))); + data.writeByte(Math.min(PipeRendererTESR.POWER_STAGES, + (int) Math.ceil(element * PipeRendererTESR.DISPLAY_MULTIPLIER))); } } } diff --git a/common/buildcraft/transport/pipes/PipeFluidsWood.java b/common/buildcraft/transport/pipes/PipeFluidsWood.java index 9f5ee2c6..a302b13c 100644 --- a/common/buildcraft/transport/pipes/PipeFluidsWood.java +++ b/common/buildcraft/transport/pipes/PipeFluidsWood.java @@ -8,16 +8,20 @@ */ package buildcraft.transport.pipes; -import cofh.api.energy.IEnergyHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.core.NetworkData; diff --git a/common/buildcraft/transport/pipes/PipeItemsObsidian.java b/common/buildcraft/transport/pipes/PipeItemsObsidian.java index 69236d1a..c961ee72 100644 --- a/common/buildcraft/transport/pipes/PipeItemsObsidian.java +++ b/common/buildcraft/transport/pipes/PipeItemsObsidian.java @@ -11,7 +11,6 @@ package buildcraft.transport.pipes; import java.util.Arrays; import java.util.List; -import cofh.api.energy.IEnergyHandler; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityMinecartChest; @@ -20,9 +19,14 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.core.Position; @@ -214,7 +218,7 @@ public class PipeItemsObsidian extends Pipe implements IEner CoreProxy.proxy.obsidianPipePickup(container.getWorldObj(), item, this.container); - int energyUsed = (int)Math.min(10 * contained.stackSize * distance, battery.getEnergyStored()); + int energyUsed = Math.min(10 * contained.stackSize * distance, battery.getEnergyStored()); // TODO: Why is energyUsed never used here? @@ -222,7 +226,7 @@ public class PipeItemsObsidian extends Pipe implements IEner stack = contained; CoreProxy.proxy.removeEntity(entity); } else { - stack = contained.splitStack((int) (energyUsed / distance)); + stack = contained.splitStack(energyUsed / distance); } speed = Math.sqrt(item.motionX * item.motionX + item.motionY * item.motionY + item.motionZ * item.motionZ); diff --git a/common/buildcraft/transport/pipes/PipeItemsStripes.java b/common/buildcraft/transport/pipes/PipeItemsStripes.java index 90ac7140..e7554e83 100755 --- a/common/buildcraft/transport/pipes/PipeItemsStripes.java +++ b/common/buildcraft/transport/pipes/PipeItemsStripes.java @@ -10,7 +10,6 @@ package buildcraft.transport.pipes; import java.util.ArrayList; -import cofh.api.energy.IEnergyHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +23,11 @@ import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.WorldServer; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.core.Position; @@ -238,9 +241,12 @@ public class PipeItemsStripes extends Pipe implements IEnerg @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - if(maxReceive == 0) return 0; - else if(simulate) return 10; - + if (maxReceive == 0) { + return 0; + } else if (simulate) { + return 10; + } + ForgeDirection o = getOpenOrientation(); if (o != ForgeDirection.UNKNOWN) { @@ -270,7 +276,7 @@ public class PipeItemsStripes extends Pipe implements IEnerg getWorld().setBlockToAir((int) p.x, (int) p.y, (int) p.z); } } - + return maxReceive; } diff --git a/common/buildcraft/transport/pipes/PipeItemsWood.java b/common/buildcraft/transport/pipes/PipeItemsWood.java index fabf7ad3..b376d013 100644 --- a/common/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/buildcraft/transport/pipes/PipeItemsWood.java @@ -8,16 +8,20 @@ */ package buildcraft.transport.pipes; -import cofh.api.energy.IEnergyHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.core.Position; diff --git a/common/buildcraft/transport/pipes/PipePowerEmerald.java b/common/buildcraft/transport/pipes/PipePowerEmerald.java index b9644cb1..540439a4 100644 --- a/common/buildcraft/transport/pipes/PipePowerEmerald.java +++ b/common/buildcraft/transport/pipes/PipePowerEmerald.java @@ -1,13 +1,16 @@ package buildcraft.transport.pipes; +import net.minecraft.item.Item; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraftforge.common.util.ForgeDirection; + import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.core.RFBattery; import buildcraft.transport.PipeIconProvider; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.item.Item; -import net.minecraftforge.common.util.ForgeDirection; public class PipePowerEmerald extends PipePowerWood { diff --git a/common/buildcraft/transport/pipes/PipePowerWood.java b/common/buildcraft/transport/pipes/PipePowerWood.java index 73fbd1c0..41f25e75 100644 --- a/common/buildcraft/transport/pipes/PipePowerWood.java +++ b/common/buildcraft/transport/pipes/PipePowerWood.java @@ -8,13 +8,17 @@ */ package buildcraft.transport.pipes; -import cofh.api.energy.IEnergyHandler; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraftforge.common.util.ForgeDirection; + +import cofh.api.energy.IEnergyHandler; + import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.power.IPowerEmitter; @@ -41,12 +45,12 @@ public class PipePowerWood extends Pipe implements IPowerRec private boolean full; private int requestedEnergy, sources; private PowerHandler powerHandler; - + public PipePowerWood(Item item) { super(new PipeTransportPower(), item); - + battery = new RFBattery(320 * 50, 320, 0); - + powerHandler = new PowerHandler(this, Type.PIPE); powerHandler.configure(0, 500, 1, 1500); powerHandler.setPerdition(new PerditionCalculator(PerditionCalculator.MIN_POWERLOSS)); @@ -86,7 +90,7 @@ public class PipePowerWood extends Pipe implements IPowerRec sources++; } } - + if (container.getWorldObj().isRemote) { // We only do the isRemote check now to get a list // of power sources for client-side rendering. @@ -109,7 +113,7 @@ public class PipePowerWood extends Pipe implements IPowerRec // and used in receiveEnergy and extractEnergy. // That way, we can replicate BC behaviour more accurately, // but we still need to see how well that works with constant power. - + /* if (mjStored > 40) { energyToRemove = mjStored / 40 + 4; } else if (mjStored > 10) { @@ -117,9 +121,9 @@ public class PipePowerWood extends Pipe implements IPowerRec } else { energyToRemove = 1; } */ - + energyToRemove /= sources; - + // Extract power from RF sources. // While we send power to receivers and so does TE4, // Extra Utilities generators (as an example) depend @@ -128,26 +132,27 @@ public class PipePowerWood extends Pipe implements IPowerRec if (!powerSources[o.ordinal()]) { continue; } - + TileEntity tile = container.getTile(o); - - if(tile instanceof IEnergyHandler) { - battery.addEnergy(0, ((IEnergyHandler)tile).extractEnergy(o.getOpposite(), energyToRemove, false), false); + + if (tile instanceof IEnergyHandler) { + battery.addEnergy(0, ((IEnergyHandler) tile).extractEnergy(o.getOpposite(), energyToRemove, false), + false); } } - + for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) { if (!powerSources[o.ordinal()]) { continue; } int energyUsable = Math.min(battery.getEnergyStored(), energyToRemove); - + if (energyUsable > 0) { battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyUsable)); } } - + requestedEnergy = 0; } @@ -205,10 +210,8 @@ public class PipePowerWood extends Pipe implements IPowerRec public boolean isPowerSource(TileEntity tile, ForgeDirection from) { if (tile instanceof IPowerEmitter && ((IPowerEmitter) tile).canEmitPowerFrom(from.getOpposite())) { return true; - } else if (tile instanceof IEnergyHandler && ((IEnergyHandler) tile).canConnectEnergy(from.getOpposite())) { - return true; } else { - return false; + return tile instanceof IEnergyHandler && ((IEnergyHandler) tile).canConnectEnergy(from.getOpposite()); } } @@ -219,7 +222,7 @@ public class PipePowerWood extends Pipe implements IPowerRec @Override public void doWork(PowerHandler workProvider) { - battery.addEnergy(0, (int)Math.round(this.powerHandler.getEnergyStored() * 10), true); + battery.addEnergy(0, (int) Math.round(this.powerHandler.getEnergyStored() * 10), true); this.powerHandler.setEnergy(0.0); } diff --git a/guidelines/buildcraft.checkstyle b/guidelines/buildcraft.checkstyle index b63553ad..1a53d181 100755 --- a/guidelines/buildcraft.checkstyle +++ b/guidelines/buildcraft.checkstyle @@ -8,7 +8,7 @@ Checkstyle-Configuration: BuildCraft Description: none --> - + @@ -24,7 +24,7 @@ - + diff --git a/guidelines/buildcraft.epf b/guidelines/buildcraft.epf index 2f92b2a8..5fd122c9 100755 --- a/guidelines/buildcraft.epf +++ b/guidelines/buildcraft.epf @@ -1,4 +1,4 @@ -#Sat May 03 19:03:24 CEST 2014 +#Thu Sep 04 20:36:31 CEST 2014 /instance/org.eclipse.jdt.ui/sp_cleanup.add_missing_annotations=true /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true @org.eclipse.ui.editors=3.8.100.v20130513-1637 @@ -102,7 +102,6 @@ /instance/org.eclipse.jdt.ui/sp_cleanup.format_source_code_changes_only=true /instance/org.eclipse.jdt.ui/sp_cleanup.remove_trailing_whitespaces_all=true /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -/configuration/org.eclipse.ui.ide/RECENT_WORKSPACES= /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert /instance/org.eclipse.jdt.ui/sp_cleanup.remove_unnecessary_nls_tags=false /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert @@ -224,6 +223,7 @@ /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.tabulation.size=4 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +/instance/org.eclipse.jdt.ui/LexicalSortingAction.isChecked=true @org.eclipse.ui.browser=3.4.100.v20130527-1656 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert /instance/org.eclipse.jdt.ui/useQuickDiffPrefPage=true @@ -314,10 +314,10 @@ /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert /instance/org.eclipse.jdt.ui/sp_cleanup.on_save_use_additional_actions=true -/instance/org.eclipse.jdt.ui/content_assist_lru_history= +/instance/org.eclipse.jdt.ui/content_assist_lru_history= /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -/instance/org.eclipse.debug.ui/preferredDetailPanes=DefaultDetailPane\:DefaultDetailPane|org.eclipse.jdt.debug.ui.DETAIL_PANE_LINE_BREAKPOINT\:org.eclipse.jdt.debug.ui.DETAIL_PANE_LINE_BREAKPOINT|org.eclipse.jdt.debug.ui.DETAIL_PANE_EXCEPTION_BREAKPOINT\:org.eclipse.jdt.debug.ui.DETAIL_PANE_EXCEPTION_BREAKPOINT| +/instance/org.eclipse.debug.ui/preferredDetailPanes=DefaultDetailPane\:DefaultDetailPane|org.eclipse.jdt.debug.ui.DETAIL_PANE_LINE_BREAKPOINT\:org.eclipse.jdt.debug.ui.DETAIL_PANE_LINE_BREAKPOINT|org.eclipse.jdt.debug.ui.DETAIL_PANE_EXCEPTION_BREAKPOINT\:org.eclipse.jdt.debug.ui.DETAIL_PANE_EXCEPTION_BREAKPOINT|org.eclipse.jdt.debug.ui.DETAIL_PANE_STANDARD\:org.eclipse.jdt.debug.ui.DETAIL_PANE_STANDARD| /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert @@ -333,7 +333,7 @@ /instance/org.eclipse.jdt.ui/sp_cleanup.add_default_serial_version_id=true @org.eclipse.jdt.ui=3.9.2.v20131106-1600 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.comment.line_length=80 -/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=java;javax;com;org;io;net.minecraft;cpw;net.minecraftforge;buildcraft; +/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=java;javax;com;org;io;net.minecraft;cpw;net.minecraftforge;cofh;buildcraft; /instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.text.code_templates_migrated=true /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert @@ -376,8 +376,8 @@ file_export_version=3.0 /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -/instance/org.eclipse.jdt.ui/fontPropagated=true /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +/instance/org.eclipse.jdt.ui/fontPropagated=true /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on /instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert