From 428b187722a8cc72872a30d7eed3eff67043e691 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Fri, 31 Jan 2014 23:08:30 +0800 Subject: [PATCH] Minor clean up --- .../api/fluid/IFluidNetwork.java | 76 ++-- .../api/fluid/IFluidPipe.java | 2 +- .../archaic/firebox/BlockHotPlate.java | 3 - .../archaic/firebox/TileHotPlate.java | 2 - .../archaic/imprint/ItemImprint.java | 2 +- .../archaic/process/BlockMillstone.java | 8 - .../archaic/process/RenderMillstone.java | 1 - .../archaic/process/TileMillstone.java | 1 + .../resonantinduction/core/SoundHandler.java | 2 +- .../core/handler/FluidEventHandler.java | 3 +- .../core/handler/ToolModeLink.java | 6 +- .../core/prefab/block/BlockIOBase.java | 40 +- .../core/prefab/block/BlockRI.java | 2 +- .../core/prefab/block/BlockRIRotatable.java | 2 +- .../core/prefab/item/ItemRI.java | 2 +- .../core/prefab/part/ItemMultipartBase.java | 2 +- .../core/prefab/part/PacketMultiPart.java | 2 +- .../core/prefab/tile/TileMachine.java | 228 +++++------ .../core/render/RenderItemOverlayTile.java | 1 - .../core/render/RenderRIItem.java | 3 +- .../core/resource/BlockDust.java | 10 +- .../core/resource/TileMaterial.java | 10 +- .../resource/fluid/BlockFluidMaterial.java | 5 - .../core/resource/fluid/TileFluidMixture.java | 5 +- .../core/resource/item/ItemOreResource.java | 6 +- .../core/resource/item/ItemParts.java | 172 ++++----- .../electrical/Electrical.java | 7 +- .../electrical/armbot/BlockArmbot.java | 2 +- .../electrical/battery/BatteryNetwork.java | 4 +- .../electrical/battery/BlockBattery.java | 6 +- .../electrical/battery/TileBattery.java | 2 +- .../electrical/encoder/TileEncoder.java | 362 +++++++++--------- .../generator/thermopile/BlockThermopile.java | 3 - .../electrical/multimeter/Graph.java | 2 - .../electrical/multimeter/GraphF.java | 3 + .../electrical/multimeter/GraphL.java | 3 + .../electrical/multimeter/ItemMultimeter.java | 2 - .../transformer/ItemTransformer.java | 2 +- .../electrical/wire/ItemWire.java | 2 +- .../electrical/wire/flat/PartFlatWire.java | 4 +- .../wire/framed/PartFramedWire.java | 4 +- .../electrical/wire/trait/TraitConductor.java | 2 +- .../wire/trait/TraitEnergyHandler.java | 2 +- .../mechanical/belt/TileConveyorBelt.java | 3 +- .../fluid/network/FluidNetwork.java | 1 + .../mechanical/fluid/network/PipeNetwork.java | 244 ++++++------ .../mechanical/fluid/pipe/PartPipe.java | 350 ++++++++--------- .../mechanical/fluid/tank/TankNetwork.java | 123 +++--- .../gear/GearMultiBlockHandler.java | 1 + .../mechanical/gear/ItemGear.java | 1 - .../mechanical/gear/PartGear.java | 4 +- .../mechanical/gear/PartGearShaft.java | 6 +- .../mechanical/gear/RenderGear.java | 2 - .../mechanical/gear/RenderGearShaft.java | 1 - .../mechanical/motor/BlockFluidMotor.java | 116 +++--- .../mechanical/motor/TileFluidMotor.java | 154 ++++---- .../mechanical/network/IMechanical.java | 1 + .../mechanical/network/MechanicalNetwork.java | 3 +- .../mechanical/network/PacketNetwork.java | 6 +- .../mechanical/network/PartMechanical.java | 6 - .../mechanical/network/TileMechanical.java | 4 +- .../mechanical/process/BlockFilter.java | 82 ++-- .../mechanical/process/TileGrinderWheel.java | 8 +- .../mechanical/process/TileMixer.java | 1 - .../mechanical/turbine/BlockWindTurbine.java | 2 - .../mechanical/turbine/RenderWindTurbine.java | 3 +- .../mechanical/turbine/TileWindTurbine.java | 2 +- 67 files changed, 1047 insertions(+), 1085 deletions(-) diff --git a/src/main/java/resonantinduction/api/fluid/IFluidNetwork.java b/src/main/java/resonantinduction/api/fluid/IFluidNetwork.java index 7036381f6..1a66496c5 100644 --- a/src/main/java/resonantinduction/api/fluid/IFluidNetwork.java +++ b/src/main/java/resonantinduction/api/fluid/IFluidNetwork.java @@ -7,48 +7,56 @@ import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; import universalelectricity.api.net.INodeNetwork; -/** Interface version of the fluid network. +/** + * Interface version of the fluid network. * - * @author DarkGuardsman */ + * @author DarkGuardsman + */ public interface IFluidNetwork extends INodeNetwork { - /** Called to build the network when something changes such as addition of a pipe */ - @Override - void reconstruct(); + /** Called to build the network when something changes such as addition of a pipe */ + @Override + void reconstruct(); - /** Called to add fluid into the network - * - * @param source - part that is receiving the fluid for the network - * @param from - direction of this connection - * @param resource - fluid stack that is being filled into the network - * @param doFill - true causes the action to be taken, false simulates the action - * @return amount of fluid filled into the network */ - int fill(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doFill); + /** + * Called to add fluid into the network + * + * @param source - part that is receiving the fluid for the network + * @param from - direction of this connection + * @param resource - fluid stack that is being filled into the network + * @param doFill - true causes the action to be taken, false simulates the action + * @return amount of fluid filled into the network + */ + int fill(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doFill); - /** Called to remove fluid from a network, not supported by all networks - * - * @param source - part that is receiving the fluid for the network - * @param from - direction of this connection - * @param resource - fluid stack that is being filled into the network - * @param doDrain - true causes the action to be taken, false simulates the action - * @return FluidStack that contains the fluid drained from the network */ - FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain); + /** + * Called to remove fluid from a network, not supported by all networks + * + * @param source - part that is receiving the fluid for the network + * @param from - direction of this connection + * @param resource - fluid stack that is being filled into the network + * @param doDrain - true causes the action to be taken, false simulates the action + * @return FluidStack that contains the fluid drained from the network + */ + FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain); - /** Called to remove fluid from a network, not supported by all networks - * - * @param source - part that is receiving the fluid for the network - * @param from - direction of this connection - * @param resource - fluid stack that is being filled into the network - * @param doDrain - true causes the action to be taken, false simulates the action - * @return FluidStack that contains the fluid drained from the network */ - FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain); + /** + * Called to remove fluid from a network, not supported by all networks + * + * @param source - part that is receiving the fluid for the network + * @param from - direction of this connection + * @param resource - fluid stack that is being filled into the network + * @param doDrain - true causes the action to be taken, false simulates the action + * @return FluidStack that contains the fluid drained from the network + */ + FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain); - /** Fluid tank that represents the entire network */ - FluidTank getTank(); + /** Fluid tank that represents the entire network */ + FluidTank getTank(); - /** Information about the network's tank */ - FluidTankInfo[] getTankInfo(); + /** Information about the network's tank */ + FluidTankInfo[] getTankInfo(); - int getPressure(); + int getPressure(); } diff --git a/src/main/java/resonantinduction/api/fluid/IFluidPipe.java b/src/main/java/resonantinduction/api/fluid/IFluidPipe.java index 054c2e4f3..9718566f8 100644 --- a/src/main/java/resonantinduction/api/fluid/IFluidPipe.java +++ b/src/main/java/resonantinduction/api/fluid/IFluidPipe.java @@ -13,7 +13,7 @@ public interface IFluidPipe extends IFluidConnector, IPressureInput * @return amount in pascals. */ int getMaxPressure(); - + int getPressure(); /** diff --git a/src/main/java/resonantinduction/archaic/firebox/BlockHotPlate.java b/src/main/java/resonantinduction/archaic/firebox/BlockHotPlate.java index 150c3af3a..c2b615dff 100644 --- a/src/main/java/resonantinduction/archaic/firebox/BlockHotPlate.java +++ b/src/main/java/resonantinduction/archaic/firebox/BlockHotPlate.java @@ -1,14 +1,11 @@ package resonantinduction.archaic.firebox; -import java.util.List; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.util.Icon; diff --git a/src/main/java/resonantinduction/archaic/firebox/TileHotPlate.java b/src/main/java/resonantinduction/archaic/firebox/TileHotPlate.java index 7b126f83c..6557e6f71 100644 --- a/src/main/java/resonantinduction/archaic/firebox/TileHotPlate.java +++ b/src/main/java/resonantinduction/archaic/firebox/TileHotPlate.java @@ -9,9 +9,7 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; import resonantinduction.core.ResonantInduction; -import universalelectricity.api.energy.EnergyStorageHandler; import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketSender; import calclavia.lib.network.PacketHandler; diff --git a/src/main/java/resonantinduction/archaic/imprint/ItemImprint.java b/src/main/java/resonantinduction/archaic/imprint/ItemImprint.java index 36a1f84d2..91fe712c0 100644 --- a/src/main/java/resonantinduction/archaic/imprint/ItemImprint.java +++ b/src/main/java/resonantinduction/archaic/imprint/ItemImprint.java @@ -14,8 +14,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; public class ItemImprint extends Item { diff --git a/src/main/java/resonantinduction/archaic/process/BlockMillstone.java b/src/main/java/resonantinduction/archaic/process/BlockMillstone.java index 18fe4424d..83949db8f 100644 --- a/src/main/java/resonantinduction/archaic/process/BlockMillstone.java +++ b/src/main/java/resonantinduction/archaic/process/BlockMillstone.java @@ -1,6 +1,5 @@ package resonantinduction.archaic.process; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -9,17 +8,10 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import resonantinduction.api.recipe.MachineRecipes; -import resonantinduction.api.recipe.MachineRecipes.RecipeType; -import resonantinduction.archaic.crate.TileCrate; import resonantinduction.core.Reference; import resonantinduction.core.prefab.block.BlockRI; -import universalelectricity.api.vector.Vector2; import universalelectricity.api.vector.Vector3; -import universalelectricity.api.vector.VectorWorld; import calclavia.lib.utility.inventory.InventoryUtility; -import codechicken.multipart.ControlKeyModifer; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/archaic/process/RenderMillstone.java b/src/main/java/resonantinduction/archaic/process/RenderMillstone.java index ba3de6faa..a2083a6e8 100644 --- a/src/main/java/resonantinduction/archaic/process/RenderMillstone.java +++ b/src/main/java/resonantinduction/archaic/process/RenderMillstone.java @@ -2,7 +2,6 @@ package resonantinduction.archaic.process; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.ForgeDirection; import resonantinduction.core.render.RenderItemOverlayTile; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/archaic/process/TileMillstone.java b/src/main/java/resonantinduction/archaic/process/TileMillstone.java index e862ce469..43033922b 100644 --- a/src/main/java/resonantinduction/archaic/process/TileMillstone.java +++ b/src/main/java/resonantinduction/archaic/process/TileMillstone.java @@ -20,6 +20,7 @@ public class TileMillstone extends TileExternalInventory implements IPacketRecei { private int grindCount = 0; + @Override public void onInventoryChanged() { grindCount = 0; diff --git a/src/main/java/resonantinduction/core/SoundHandler.java b/src/main/java/resonantinduction/core/SoundHandler.java index 73775363b..599b2ddd9 100644 --- a/src/main/java/resonantinduction/core/SoundHandler.java +++ b/src/main/java/resonantinduction/core/SoundHandler.java @@ -17,7 +17,7 @@ public class SoundHandler { public static final SoundHandler INSTANCE = new SoundHandler(); - public static final String[] SOUND_FILES = { "hammer.ogg", "grinder1.ogg", "grinder2.ogg", "grinder3.ogg", "grinder4.ogg", "electricshock1.ogg", "electricshock2.ogg", "electricshock3.ogg", "electricshock4.ogg", "electricshock5.ogg", "electricshock6.ogg", "electricshock7.ogg" , "conveyor.ogg" }; + public static final String[] SOUND_FILES = { "hammer.ogg", "grinder1.ogg", "grinder2.ogg", "grinder3.ogg", "grinder4.ogg", "electricshock1.ogg", "electricshock2.ogg", "electricshock3.ogg", "electricshock4.ogg", "electricshock5.ogg", "electricshock6.ogg", "electricshock7.ogg", "conveyor.ogg" }; @ForgeSubscribe public void loadSoundEvents(SoundLoadEvent event) diff --git a/src/main/java/resonantinduction/core/handler/FluidEventHandler.java b/src/main/java/resonantinduction/core/handler/FluidEventHandler.java index 5835093e8..982617a50 100644 --- a/src/main/java/resonantinduction/core/handler/FluidEventHandler.java +++ b/src/main/java/resonantinduction/core/handler/FluidEventHandler.java @@ -6,7 +6,6 @@ import net.minecraft.util.Icon; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.event.ForgeSubscribe; import resonantinduction.core.Reference; -import resonantinduction.core.ResonantInduction; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -37,6 +36,6 @@ public class FluidEventHandler @SideOnly(Side.CLIENT) public void textureHook(TextureStitchEvent.Post event) { - //ResonantInduction.fluidMixture.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture")); + // ResonantInduction.fluidMixture.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture")); } } diff --git a/src/main/java/resonantinduction/core/handler/ToolModeLink.java b/src/main/java/resonantinduction/core/handler/ToolModeLink.java index 6f9f5d691..7543cf2bf 100644 --- a/src/main/java/resonantinduction/core/handler/ToolModeLink.java +++ b/src/main/java/resonantinduction/core/handler/ToolModeLink.java @@ -3,15 +3,13 @@ */ package resonantinduction.core.handler; -import calclavia.components.tool.ToolMode; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import net.minecraftforge.event.Event.Result; -import net.minecraftforge.event.ForgeSubscribe; import universalelectricity.api.vector.VectorWorld; +import calclavia.components.tool.ToolMode; import codechicken.multipart.ControlKeyModifer; /** @@ -52,7 +50,7 @@ public class ToolModeLink extends ToolMode ((ILinkable) tile).onLink(player, this.getLink(stack)); } } - + return true; } diff --git a/src/main/java/resonantinduction/core/prefab/block/BlockIOBase.java b/src/main/java/resonantinduction/core/prefab/block/BlockIOBase.java index 0901b746a..9aa492a70 100644 --- a/src/main/java/resonantinduction/core/prefab/block/BlockIOBase.java +++ b/src/main/java/resonantinduction/core/prefab/block/BlockIOBase.java @@ -6,32 +6,34 @@ package resonantinduction.core.prefab.block; import net.minecraft.block.material.Material; import net.minecraftforge.common.Configuration; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; import universalelectricity.api.UniversalElectricity; import calclavia.lib.prefab.block.BlockSidedIO; -/** Blocks that have specific sided input and output should extend this. +/** + * Blocks that have specific sided input and output should extend this. * - * @author Calclavia */ + * @author Calclavia + */ public class BlockIOBase extends BlockSidedIO { - public BlockIOBase(String name) - { - this(name, Settings.getNextBlockID()); - } + public BlockIOBase(String name) + { + this(name, Settings.getNextBlockID()); + } - public BlockIOBase(String name, int id) - { - this(name, id, UniversalElectricity.machine); - } + public BlockIOBase(String name, int id) + { + this(name, id, UniversalElectricity.machine); + } - public BlockIOBase(String name, int id, Material material) - { - super(Settings.CONFIGURATION.get(Configuration.CATEGORY_BLOCK, name, id).getInt(id), material); - this.setCreativeTab(TabRI.CORE); - this.setUnlocalizedName(Reference.PREFIX + name); - this.setTextureName(Reference.PREFIX + name); - this.setHardness(1f); - } + public BlockIOBase(String name, int id, Material material) + { + super(Settings.CONFIGURATION.get(Configuration.CATEGORY_BLOCK, name, id).getInt(id), material); + this.setCreativeTab(TabRI.CORE); + this.setUnlocalizedName(Reference.PREFIX + name); + this.setTextureName(Reference.PREFIX + name); + this.setHardness(1f); + } } diff --git a/src/main/java/resonantinduction/core/prefab/block/BlockRI.java b/src/main/java/resonantinduction/core/prefab/block/BlockRI.java index fdc9ac379..f2a740129 100644 --- a/src/main/java/resonantinduction/core/prefab/block/BlockRI.java +++ b/src/main/java/resonantinduction/core/prefab/block/BlockRI.java @@ -4,8 +4,8 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.Configuration; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; import universalelectricity.api.UniversalElectricity; import calclavia.lib.prefab.block.BlockTile; import codechicken.multipart.ControlKeyModifer; diff --git a/src/main/java/resonantinduction/core/prefab/block/BlockRIRotatable.java b/src/main/java/resonantinduction/core/prefab/block/BlockRIRotatable.java index 47e66abbc..30037a4c9 100644 --- a/src/main/java/resonantinduction/core/prefab/block/BlockRIRotatable.java +++ b/src/main/java/resonantinduction/core/prefab/block/BlockRIRotatable.java @@ -3,8 +3,8 @@ package resonantinduction.core.prefab.block; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.Configuration; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; import universalelectricity.api.UniversalElectricity; import calclavia.lib.prefab.block.BlockRotatable; import codechicken.multipart.ControlKeyModifer; diff --git a/src/main/java/resonantinduction/core/prefab/item/ItemRI.java b/src/main/java/resonantinduction/core/prefab/item/ItemRI.java index 19f3b0667..d480d9fef 100644 --- a/src/main/java/resonantinduction/core/prefab/item/ItemRI.java +++ b/src/main/java/resonantinduction/core/prefab/item/ItemRI.java @@ -3,8 +3,8 @@ package resonantinduction.core.prefab.item; import net.minecraft.item.Item; import net.minecraftforge.common.Configuration; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; /** @author Calclavia */ public class ItemRI extends Item diff --git a/src/main/java/resonantinduction/core/prefab/part/ItemMultipartBase.java b/src/main/java/resonantinduction/core/prefab/part/ItemMultipartBase.java index 946874561..8fe42025c 100644 --- a/src/main/java/resonantinduction/core/prefab/part/ItemMultipartBase.java +++ b/src/main/java/resonantinduction/core/prefab/part/ItemMultipartBase.java @@ -2,8 +2,8 @@ package resonantinduction.core.prefab.part; import net.minecraftforge.common.Configuration; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; import codechicken.multipart.JItemMultiPart; /** diff --git a/src/main/java/resonantinduction/core/prefab/part/PacketMultiPart.java b/src/main/java/resonantinduction/core/prefab/part/PacketMultiPart.java index ebd9be928..3f4d8ecc1 100644 --- a/src/main/java/resonantinduction/core/prefab/part/PacketMultiPart.java +++ b/src/main/java/resonantinduction/core/prefab/part/PacketMultiPart.java @@ -50,7 +50,7 @@ public class PacketMultiPart extends PacketType int y = data.readInt(); int z = data.readInt(); TileEntity tileEntity = player.worldObj.getBlockTileEntity(x, y, z); - + if (tileEntity instanceof TileMultipart) { TMultiPart part = ((TileMultipart) tileEntity).partMap(data.readInt()); diff --git a/src/main/java/resonantinduction/core/prefab/tile/TileMachine.java b/src/main/java/resonantinduction/core/prefab/tile/TileMachine.java index b9d8cf45d..5c8adcb02 100644 --- a/src/main/java/resonantinduction/core/prefab/tile/TileMachine.java +++ b/src/main/java/resonantinduction/core/prefab/tile/TileMachine.java @@ -13,133 +13,135 @@ import calclavia.lib.prefab.tile.TileElectrical; import com.google.common.io.ByteArrayDataInput; -/** Prefab for general machines +/** + * Prefab for general machines * - * @author Darkguardsman */ + * @author Darkguardsman + */ public class TileMachine extends TileElectrical implements IPacketReceiverWithID { - /** Is the machine functioning normally */ - protected boolean functioning = false; - /** Prev state of function of last update */ - protected boolean prevFunctioning = false; + /** Is the machine functioning normally */ + protected boolean functioning = false; + /** Prev state of function of last update */ + protected boolean prevFunctioning = false; - protected long joulesPerTick = 0; + protected long joulesPerTick = 0; - public static final int IS_RUN_PACKET_ID = 0; - public static final int NBT_PACKET_ID = 1; - public static final int ENERGY_PACKET_ID = 2; + public static final int IS_RUN_PACKET_ID = 0; + public static final int NBT_PACKET_ID = 1; + public static final int ENERGY_PACKET_ID = 2; - @Override - public void updateEntity() - { - super.updateEntity(); - if (!this.worldObj.isRemote) - { - this.prevFunctioning = this.functioning; - this.functioning = this.isFunctioning(); + @Override + public void updateEntity() + { + super.updateEntity(); + if (!this.worldObj.isRemote) + { + this.prevFunctioning = this.functioning; + this.functioning = this.isFunctioning(); - if (prevFunctioning != this.functioning) - { - this.sendRunningPacket(); - } - if(this.isFunctioning()) - { - this.consumePower(true); - } - } - } + if (prevFunctioning != this.functioning) + { + this.sendRunningPacket(); + } + if (this.isFunctioning()) + { + this.consumePower(true); + } + } + } - public boolean consumePower(boolean doConsume) - { - return this.consumePower(this.joulesPerTick, doConsume); - } + public boolean consumePower(boolean doConsume) + { + return this.consumePower(this.joulesPerTick, doConsume); + } - public boolean consumePower(long joules, boolean doConsume) - { - return this.energy.extractEnergy(joules, doConsume) >= joules; - } + public boolean consumePower(long joules, boolean doConsume) + { + return this.energy.extractEnergy(joules, doConsume) >= joules; + } - /** Can this tile function, or run threw normal processes */ - public boolean canFunction() - { - return this.consumePower(false); - } + /** Can this tile function, or run threw normal processes */ + public boolean canFunction() + { + return this.consumePower(false); + } - /** Called too see if the machine is functioning, server side it redirects to canFunction */ - public boolean isFunctioning() - { - if (this.worldObj.isRemote) - { - return this.functioning; - } - else - { - return this.canFunction(); - } - } + /** Called too see if the machine is functioning, server side it redirects to canFunction */ + public boolean isFunctioning() + { + if (this.worldObj.isRemote) + { + return this.functioning; + } + else + { + return this.canFunction(); + } + } - @Override - public boolean onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra) - { - try - { - if (this.worldObj.isRemote) - { - if (id == IS_RUN_PACKET_ID) - { - this.functioning = data.readBoolean(); - return true; - } - if (id == NBT_PACKET_ID) - { - this.readFromNBT(PacketHandler.readNBTTagCompound(data)); - return true; - } - if (id == ENERGY_PACKET_ID) - { - this.energy.readFromNBT(PacketHandler.readNBTTagCompound(data)); - return true; - } - } - } - catch (IOException e) - { - e.printStackTrace(); - } - return false; - } + @Override + public boolean onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra) + { + try + { + if (this.worldObj.isRemote) + { + if (id == IS_RUN_PACKET_ID) + { + this.functioning = data.readBoolean(); + return true; + } + if (id == NBT_PACKET_ID) + { + this.readFromNBT(PacketHandler.readNBTTagCompound(data)); + return true; + } + if (id == ENERGY_PACKET_ID) + { + this.energy.readFromNBT(PacketHandler.readNBTTagCompound(data)); + return true; + } + } + } + catch (IOException e) + { + e.printStackTrace(); + } + return false; + } - /** Sends the tileEntity save data to the client */ - public void sendNBTPacket() - { - if (!this.worldObj.isRemote) - { - NBTTagCompound tag = new NBTTagCompound(); - this.writeToNBT(tag); - PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, NBT_PACKET_ID, this, tag), worldObj, new Vector3(this), 64); - } - } + /** Sends the tileEntity save data to the client */ + public void sendNBTPacket() + { + if (!this.worldObj.isRemote) + { + NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, NBT_PACKET_ID, this, tag), worldObj, new Vector3(this), 64); + } + } - /** Sends a simple true/false am running power update */ - public void sendRunningPacket() - { - if (!this.worldObj.isRemote) - { - PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, IS_RUN_PACKET_ID, this, this.functioning), worldObj, new Vector3(this), 64); - } - } + /** Sends a simple true/false am running power update */ + public void sendRunningPacket() + { + if (!this.worldObj.isRemote) + { + PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, IS_RUN_PACKET_ID, this, this.functioning), worldObj, new Vector3(this), 64); + } + } - public void sendPowerPacket() - { - if (!this.worldObj.isRemote) - { - PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, ENERGY_PACKET_ID, this, this.energy.writeToNBT(new NBTTagCompound())), worldObj, new Vector3(this), 64); - } - } + public void sendPowerPacket() + { + if (!this.worldObj.isRemote) + { + PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, ENERGY_PACKET_ID, this, this.energy.writeToNBT(new NBTTagCompound())), worldObj, new Vector3(this), 64); + } + } - @Override - public Packet getDescriptionPacket() - { - return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning); - } + @Override + public Packet getDescriptionPacket() + { + return ResonantInduction.PACKET_TILE.getPacket(this, this.functioning); + } } diff --git a/src/main/java/resonantinduction/core/render/RenderItemOverlayTile.java b/src/main/java/resonantinduction/core/render/RenderItemOverlayTile.java index 2cf837d8d..a2ab6768e 100644 --- a/src/main/java/resonantinduction/core/render/RenderItemOverlayTile.java +++ b/src/main/java/resonantinduction/core/render/RenderItemOverlayTile.java @@ -21,7 +21,6 @@ import org.lwjgl.opengl.GL11; import universalelectricity.api.vector.Vector3; import calclavia.lib.render.RenderUtility; import calclavia.lib.utility.WorldUtility; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/core/render/RenderRIItem.java b/src/main/java/resonantinduction/core/render/RenderRIItem.java index 73ea74b00..e4316071e 100644 --- a/src/main/java/resonantinduction/core/render/RenderRIItem.java +++ b/src/main/java/resonantinduction/core/render/RenderRIItem.java @@ -15,7 +15,6 @@ import resonantinduction.mechanical.gear.ItemGear; import resonantinduction.mechanical.gear.ItemGearShaft; import resonantinduction.mechanical.gear.RenderGear; import resonantinduction.mechanical.gear.RenderGearShaft; -import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -59,7 +58,7 @@ public class RenderRIItem implements IItemRenderer } else if (item.getItem() instanceof ItemMultimeter) { - RenderMultimeter.INSTANCE.render(); + RenderMultimeter.render(); } else if (item.getItem() instanceof ItemTransformer) { diff --git a/src/main/java/resonantinduction/core/resource/BlockDust.java b/src/main/java/resonantinduction/core/resource/BlockDust.java index 6e3588dc5..17a340aeb 100644 --- a/src/main/java/resonantinduction/core/resource/BlockDust.java +++ b/src/main/java/resonantinduction/core/resource/BlockDust.java @@ -5,13 +5,9 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityFallingSand; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import resonantinduction.core.Reference; @@ -46,7 +42,7 @@ public class BlockDust extends BlockRI if (tileEntity instanceof TileMaterial) { - ((TileMaterial) tileEntity).name = ((ItemOreResource) itemStack.getItem()).getMaterialFromStack(itemStack); + ((TileMaterial) tileEntity).name = ItemOreResource.getMaterialFromStack(itemStack); } } @@ -147,7 +143,7 @@ public class BlockDust extends BlockRI { int l = par1World.getBlockMetadata(par2, par3, par4) & 7; float f = 0.125F; - return AxisAlignedBB.getAABBPool().getAABB((double) par2 + this.minX, (double) par3 + this.minY, (double) par4 + this.minZ, (double) par2 + this.maxX, (double) ((float) par3 + (float) l * f), (double) par4 + this.maxZ); + return AxisAlignedBB.getAABBPool().getAABB(par2 + this.minX, par3 + this.minY, par4 + this.minZ, par2 + this.maxX, par3 + l * f, par4 + this.maxZ); } /** @@ -197,7 +193,7 @@ public class BlockDust extends BlockRI protected void setBlockBoundsForDepth(int par1) { int j = par1 & 7; - float f = (float) (2 * (1 + j)) / 16.0F; + float f = 2 * (1 + j) / 16.0F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); } diff --git a/src/main/java/resonantinduction/core/resource/TileMaterial.java b/src/main/java/resonantinduction/core/resource/TileMaterial.java index 411dabd5a..78e7602ec 100644 --- a/src/main/java/resonantinduction/core/resource/TileMaterial.java +++ b/src/main/java/resonantinduction/core/resource/TileMaterial.java @@ -1,18 +1,14 @@ package resonantinduction.core.resource; -import resonantinduction.core.ResonantInduction; - -import com.google.common.io.ByteArrayDataInput; - import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.packet.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; +import resonantinduction.core.ResonantInduction; import calclavia.lib.network.IPacketReceiver; import calclavia.lib.prefab.tile.TileAdvanced; +import com.google.common.io.ByteArrayDataInput; + /** * A tile that stores the material name. * diff --git a/src/main/java/resonantinduction/core/resource/fluid/BlockFluidMaterial.java b/src/main/java/resonantinduction/core/resource/fluid/BlockFluidMaterial.java index 04ae9fa13..cefc16a2e 100644 --- a/src/main/java/resonantinduction/core/resource/fluid/BlockFluidMaterial.java +++ b/src/main/java/resonantinduction/core/resource/fluid/BlockFluidMaterial.java @@ -1,9 +1,6 @@ package resonantinduction.core.resource.fluid; -import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.Configuration; @@ -12,10 +9,8 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import resonantinduction.core.Reference; -import resonantinduction.core.ResonantInduction; import resonantinduction.core.Settings; import resonantinduction.core.resource.ResourceGenerator; -import resonantinduction.core.resource.TileMaterial; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/core/resource/fluid/TileFluidMixture.java b/src/main/java/resonantinduction/core/resource/fluid/TileFluidMixture.java index c54cb5f2c..4c9545f18 100644 --- a/src/main/java/resonantinduction/core/resource/fluid/TileFluidMixture.java +++ b/src/main/java/resonantinduction/core/resource/fluid/TileFluidMixture.java @@ -3,8 +3,6 @@ package resonantinduction.core.resource.fluid; import java.util.HashSet; import java.util.Set; -import com.google.common.io.ByteArrayDataInput; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -17,6 +15,9 @@ import resonantinduction.core.ResonantInduction; import resonantinduction.core.resource.ResourceGenerator; import calclavia.lib.network.IPacketReceiver; import calclavia.lib.prefab.tile.TileAdvanced; + +import com.google.common.io.ByteArrayDataInput; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/core/resource/item/ItemOreResource.java b/src/main/java/resonantinduction/core/resource/item/ItemOreResource.java index 18f1d766f..05503d839 100644 --- a/src/main/java/resonantinduction/core/resource/item/ItemOreResource.java +++ b/src/main/java/resonantinduction/core/resource/item/ItemOreResource.java @@ -6,7 +6,6 @@ import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; @@ -20,7 +19,6 @@ import resonantinduction.core.resource.TileMaterial; import universalelectricity.api.vector.Vector3; import calclavia.lib.utility.LanguageUtility; import calclavia.lib.utility.inventory.InventoryUtility; -import calclavia.lib.utility.nbt.NBTUtility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -92,7 +90,7 @@ public class ItemOreResource extends ItemRI if (k1 <= 6 && world.checkNoEntityCollision(block.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlockMetadataWithNotify(x, y, z, k1 + 1 | j1 & -8, 2)) { - world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); --stack.stackSize; return true; } @@ -137,7 +135,7 @@ public class ItemOreResource extends ItemRI if (placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, k1)) { - world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); --stack.stackSize; } diff --git a/src/main/java/resonantinduction/core/resource/item/ItemParts.java b/src/main/java/resonantinduction/core/resource/item/ItemParts.java index 2a17a15fd..bafeee9de 100644 --- a/src/main/java/resonantinduction/core/resource/item/ItemParts.java +++ b/src/main/java/resonantinduction/core/resource/item/ItemParts.java @@ -13,108 +13,102 @@ import resonantinduction.core.prefab.item.ItemRI; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -/** A meta data item containing parts of various crafting recipes. These parts do not do anything but +/** + * A meta data item containing parts of various crafting recipes. These parts do not do anything but * allow new crafting recipes to be created. * - * @author DarkGuardsman */ + * @author DarkGuardsman + */ public class ItemParts extends ItemRI { - public ItemParts() - { - super("DMParts", Settings.getNextItemID()); - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setMaxStackSize(64); - this.setCreativeTab(CreativeTabs.tabMaterials); - } + public ItemParts() + { + super("DMParts", Settings.getNextItemID()); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setMaxStackSize(64); + this.setCreativeTab(CreativeTabs.tabMaterials); + } - @Override - public String getUnlocalizedName(ItemStack itemStack) - { - if (itemStack != null && itemStack.getItemDamage() < Parts.values().length) - { - return "item." + Parts.values()[itemStack.getItemDamage()].name; - } - return super.getUnlocalizedName(); - } + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + if (itemStack != null && itemStack.getItemDamage() < Parts.values().length) + { + return "item." + Parts.values()[itemStack.getItemDamage()].name; + } + return super.getUnlocalizedName(); + } - @Override - @SideOnly(Side.CLIENT) - public Icon getIconFromDamage(int meta) - { - if (meta < Parts.values().length) - { - return Parts.values()[meta].icon; - } - return this.itemIcon; - } + @Override + @SideOnly(Side.CLIENT) + public Icon getIconFromDamage(int meta) + { + if (meta < Parts.values().length) + { + return Parts.values()[meta].icon; + } + return this.itemIcon; + } - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IconRegister iconRegister) - { - super.registerIcons(iconRegister); - for (Parts part : Parts.values()) - { - part.icon = iconRegister.registerIcon(Reference.PREFIX + "part." + part.name); - } - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + super.registerIcons(iconRegister); + for (Parts part : Parts.values()) + { + part.icon = iconRegister.registerIcon(Reference.PREFIX + "part." + part.name); + } + } - @Override - public int getMetadata(int meta) - { - return meta; - } + @Override + public int getMetadata(int meta) + { + return meta; + } - @Override - public void getSubItems(int blockID, CreativeTabs tab, List itemStackList) - { - for (Parts part : Parts.values()) - { - if (part.show) - { - itemStackList.add(new ItemStack(this, 1, part.ordinal())); - } - } - } + @Override + public void getSubItems(int blockID, CreativeTabs tab, List itemStackList) + { + for (Parts part : Parts.values()) + { + if (part.show) + { + itemStackList.add(new ItemStack(this, 1, part.ordinal())); + } + } + } - public static enum Parts - { - Seal("leatherSeal"), - GasSeal("gasSeal"), - Tank("unfinishedTank"), - Valve("valvePart"), - MiningIcon("miningIcon", false), - CircuitBasic("circuitBasic"), - CircuitAdvanced("circuitAdvanced"), - CircuitElite("circuitElite"), - Motor("motor"), - IC("ic_chip"), - COIL("coilCopper"), - LASER("diodeLaser"); + public static enum Parts + { + Seal("leatherSeal"), GasSeal("gasSeal"), Tank("unfinishedTank"), Valve("valvePart"), + MiningIcon("miningIcon", false), CircuitBasic("circuitBasic"), + CircuitAdvanced("circuitAdvanced"), CircuitElite("circuitElite"), Motor("motor"), + IC("ic_chip"), COIL("coilCopper"), LASER("diodeLaser"); - public String name; - public Icon icon; - boolean show = true; + public String name; + public Icon icon; + boolean show = true; - private Parts(String name) - { - this.name = name; - } + private Parts(String name) + { + this.name = name; + } - private Parts(String name, boolean show) - { - this(name); - this.show = show; - } - } + private Parts(String name, boolean show) + { + this(name); + this.show = show; + } + } - public void loadOreNames() - { - for (Parts part : Parts.values()) - { - OreDictionary.registerOre(part.name, new ItemStack(this, 1, part.ordinal())); - } + public void loadOreNames() + { + for (Parts part : Parts.values()) + { + OreDictionary.registerOre(part.name, new ItemStack(this, 1, part.ordinal())); + } - } + } } diff --git a/src/main/java/resonantinduction/electrical/Electrical.java b/src/main/java/resonantinduction/electrical/Electrical.java index 5b995f899..8e53c6485 100644 --- a/src/main/java/resonantinduction/electrical/Electrical.java +++ b/src/main/java/resonantinduction/electrical/Electrical.java @@ -8,22 +8,17 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import resonantinduction.core.Reference; import resonantinduction.core.ResonantInduction; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; import resonantinduction.electrical.battery.BlockBattery; import resonantinduction.electrical.battery.ItemBlockBattery; import resonantinduction.electrical.battery.TileBattery; -import resonantinduction.electrical.encoder.BlockEncoder; import resonantinduction.electrical.encoder.ItemDisk; -import resonantinduction.electrical.encoder.TileEncoder; -import resonantinduction.electrical.furnace.BlockAdvancedFurnace; -import resonantinduction.electrical.furnace.TileAdvancedFurnace; import resonantinduction.electrical.generator.BlockGenerator; import resonantinduction.electrical.generator.TileGenerator; import resonantinduction.electrical.generator.solar.BlockSolarPanel; diff --git a/src/main/java/resonantinduction/electrical/armbot/BlockArmbot.java b/src/main/java/resonantinduction/electrical/armbot/BlockArmbot.java index c250215f7..c43f2dfcd 100644 --- a/src/main/java/resonantinduction/electrical/armbot/BlockArmbot.java +++ b/src/main/java/resonantinduction/electrical/armbot/BlockArmbot.java @@ -69,7 +69,7 @@ public class BlockArmbot extends BlockRI implements IBlockInfo ((TileArmbot) tileEntity).dropHeldObject(); CalclaviaLoader.blockMulti.destroyMultiBlockStructure((TileArmbot) tileEntity); } - + this.dropBlockAsItem_do(world, x, y, z, new ItemStack(this)); super.breakBlock(world, x, y, z, par5, par6); } diff --git a/src/main/java/resonantinduction/electrical/battery/BatteryNetwork.java b/src/main/java/resonantinduction/electrical/battery/BatteryNetwork.java index e0203e7af..608367485 100644 --- a/src/main/java/resonantinduction/electrical/battery/BatteryNetwork.java +++ b/src/main/java/resonantinduction/electrical/battery/BatteryNetwork.java @@ -20,7 +20,7 @@ public class BatteryNetwork extends Network /** * Apply energy loss. */ - double percentageLoss = Math.max(0, (1 - ((double) (getConnectors().size() * 6) / 100d))); + double percentageLoss = Math.max(0, (1 - (getConnectors().size() * 6 / 100d))); long energyLoss = (long) (percentageLoss * 100); totalEnergy -= energyLoss; @@ -37,7 +37,7 @@ public class BatteryNetwork extends Network if (battery != firstNode && !Arrays.asList(exclusion).contains(battery)) { double percentage = ((double) battery.energy.getEnergyCapacity() / (double) totalCapacity); - long energyForBattery = (long) Math.round(totalEnergy * percentage); + long energyForBattery = Math.round(totalEnergy * percentage); battery.energy.setEnergy(energyForBattery); remainingEnergy -= energyForBattery; } diff --git a/src/main/java/resonantinduction/electrical/battery/BlockBattery.java b/src/main/java/resonantinduction/electrical/battery/BlockBattery.java index 692db87f2..b09a4401b 100644 --- a/src/main/java/resonantinduction/electrical/battery/BlockBattery.java +++ b/src/main/java/resonantinduction/electrical/battery/BlockBattery.java @@ -52,10 +52,10 @@ public class BlockBattery extends BlockIOBase implements ITileEntityProvider { ItemBlockBattery itemBlock = (ItemBlockBattery) itemStack.getItem(); TileBattery battery = (TileBattery) world.getBlockTileEntity(x, y, z); - battery.energy.setCapacity(TileBattery.getEnergyForTier(itemBlock.getTier(itemStack))); + battery.energy.setCapacity(TileBattery.getEnergyForTier(ItemBlockBattery.getTier(itemStack))); battery.energy.setEnergy(itemBlock.getEnergy(itemStack)); battery.updateStructure(); - world.setBlockMetadataWithNotify(x, y, z, itemBlock.getTier(itemStack), 3); + world.setBlockMetadataWithNotify(x, y, z, ItemBlockBattery.getTier(itemStack), 3); } } @@ -96,7 +96,7 @@ public class BlockBattery extends BlockIOBase implements ITileEntityProvider { TileBattery battery = (TileBattery) world.getBlockTileEntity(x, y, z); ItemBlockBattery itemBlock = (ItemBlockBattery) itemStack.getItem(); - itemBlock.setTier(itemStack, (byte) metadata); + ItemBlockBattery.setTier(itemStack, (byte) metadata); itemBlock.setEnergy(itemStack, battery.energy.getEnergy()); } diff --git a/src/main/java/resonantinduction/electrical/battery/TileBattery.java b/src/main/java/resonantinduction/electrical/battery/TileBattery.java index 0ce291b44..103a0ee51 100644 --- a/src/main/java/resonantinduction/electrical/battery/TileBattery.java +++ b/src/main/java/resonantinduction/electrical/battery/TileBattery.java @@ -137,7 +137,7 @@ public class TileBattery extends TileElectrical implements IConnector queue += value; } + @Override public void doneQueue() { super.doneQueue(); @@ -28,6 +29,7 @@ public class GraphF extends Graph return 0f; } + @Override public void load(NBTTagCompound nbt) { super.load(nbt); @@ -41,6 +43,7 @@ public class GraphF extends Graph } } + @Override public NBTTagCompound save() { NBTTagCompound nbt = new NBTTagCompound(); diff --git a/src/main/java/resonantinduction/electrical/multimeter/GraphL.java b/src/main/java/resonantinduction/electrical/multimeter/GraphL.java index 24f636e7a..acb6af70c 100644 --- a/src/main/java/resonantinduction/electrical/multimeter/GraphL.java +++ b/src/main/java/resonantinduction/electrical/multimeter/GraphL.java @@ -16,6 +16,7 @@ public class GraphL extends Graph queue += value; } + @Override public void doneQueue() { super.doneQueue(); @@ -28,6 +29,7 @@ public class GraphL extends Graph return 0L; } + @Override public void load(NBTTagCompound nbt) { super.load(nbt); @@ -40,6 +42,7 @@ public class GraphL extends Graph } } + @Override public NBTTagCompound save() { NBTTagCompound nbt = new NBTTagCompound(); diff --git a/src/main/java/resonantinduction/electrical/multimeter/ItemMultimeter.java b/src/main/java/resonantinduction/electrical/multimeter/ItemMultimeter.java index 7fad47504..aa4e412db 100644 --- a/src/main/java/resonantinduction/electrical/multimeter/ItemMultimeter.java +++ b/src/main/java/resonantinduction/electrical/multimeter/ItemMultimeter.java @@ -14,10 +14,8 @@ import resonantinduction.electrical.wire.EnumWireMaterial; import calclavia.lib.utility.LanguageUtility; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Vector3; -import codechicken.multipart.ControlKeyModifer; import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.TMultiPart; -import codechicken.multipart.TileMultipart; public class ItemMultimeter extends ItemMultipartBase { diff --git a/src/main/java/resonantinduction/electrical/transformer/ItemTransformer.java b/src/main/java/resonantinduction/electrical/transformer/ItemTransformer.java index f03e09b3d..ddade1415 100644 --- a/src/main/java/resonantinduction/electrical/transformer/ItemTransformer.java +++ b/src/main/java/resonantinduction/electrical/transformer/ItemTransformer.java @@ -29,7 +29,7 @@ public class ItemTransformer extends ItemMultipartBase if (part != null) { - int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int facing = l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0))); part.preparePlacement(side, facing); } diff --git a/src/main/java/resonantinduction/electrical/wire/ItemWire.java b/src/main/java/resonantinduction/electrical/wire/ItemWire.java index c3d9586ed..4a54e6ece 100644 --- a/src/main/java/resonantinduction/electrical/wire/ItemWire.java +++ b/src/main/java/resonantinduction/electrical/wire/ItemWire.java @@ -14,8 +14,8 @@ import net.minecraftforge.common.ForgeDirection; import org.lwjgl.input.Keyboard; import resonantinduction.core.Reference; -import resonantinduction.core.TabRI; import resonantinduction.core.Settings; +import resonantinduction.core.TabRI; import resonantinduction.core.Utility; import resonantinduction.electrical.wire.flat.PartFlatWire; import resonantinduction.electrical.wire.flat.RenderFlatWire; diff --git a/src/main/java/resonantinduction/electrical/wire/flat/PartFlatWire.java b/src/main/java/resonantinduction/electrical/wire/flat/PartFlatWire.java index c9db074ba..63497f3da 100644 --- a/src/main/java/resonantinduction/electrical/wire/flat/PartFlatWire.java +++ b/src/main/java/resonantinduction/electrical/wire/flat/PartFlatWire.java @@ -382,8 +382,8 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal { // We found a wire! Merge networks! this.connections[absDir] = tp; - - if(tp instanceof PartFlatWire) + + if (tp instanceof PartFlatWire) { this.getNetwork().merge(((PartFlatWire) tp).getNetwork()); } diff --git a/src/main/java/resonantinduction/electrical/wire/framed/PartFramedWire.java b/src/main/java/resonantinduction/electrical/wire/framed/PartFramedWire.java index 39d1404db..4923a4cc5 100644 --- a/src/main/java/resonantinduction/electrical/wire/framed/PartFramedWire.java +++ b/src/main/java/resonantinduction/electrical/wire/framed/PartFramedWire.java @@ -283,7 +283,7 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN { getNetwork().getConnectors().remove(this); super.bind(t); - getNetwork().getConnectors().add((IConductor) this); + getNetwork().getConnectors().add(this); } else { @@ -372,7 +372,7 @@ public class PartFramedWire extends PartAdvancedWire implements TSlottedPart, JN try { this.getNetwork().removeConnector(this); - this.getNetwork().split((IConductor) this); + this.getNetwork().split(this); } catch (NullPointerException e) { diff --git a/src/main/java/resonantinduction/electrical/wire/trait/TraitConductor.java b/src/main/java/resonantinduction/electrical/wire/trait/TraitConductor.java index f23f6790f..e148a9116 100644 --- a/src/main/java/resonantinduction/electrical/wire/trait/TraitConductor.java +++ b/src/main/java/resonantinduction/electrical/wire/trait/TraitConductor.java @@ -113,7 +113,7 @@ public class TraitConductor extends TileMultipart implements IConductor } } } - + if (partMap(PartMap.CENTER.ordinal()) instanceof IConductor) { return ((IConductor) partMap(PartMap.CENTER.ordinal())).onReceiveEnergy(from, receive, doReceive); diff --git a/src/main/java/resonantinduction/electrical/wire/trait/TraitEnergyHandler.java b/src/main/java/resonantinduction/electrical/wire/trait/TraitEnergyHandler.java index 65a29fb34..6354c5bd5 100644 --- a/src/main/java/resonantinduction/electrical/wire/trait/TraitEnergyHandler.java +++ b/src/main/java/resonantinduction/electrical/wire/trait/TraitEnergyHandler.java @@ -112,7 +112,7 @@ public class TraitEnergyHandler extends TileMultipart implements IEnergyHandler @Override public boolean canInterface(ForgeDirection from) { - if (this.partMap(from.ordinal()) == null) + if (partMap(from.ordinal()) == null) { for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { diff --git a/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java b/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java index df9319bed..9aa6ca86d 100644 --- a/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java +++ b/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java @@ -223,6 +223,7 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl return from != getDirection() || from != getDirection().getOpposite(); } + @Override public void refresh() { boolean didRefresh = false; @@ -269,7 +270,7 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl } else if (tile instanceof IMechanical) { - IMechanical mechanical = (IMechanical) ((IMechanical) tile).getInstance(dir.getOpposite()); + IMechanical mechanical = ((IMechanical) tile).getInstance(dir.getOpposite()); if (mechanical != null) { diff --git a/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java b/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java index 1b18e8b18..110cc0677 100644 --- a/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java +++ b/src/main/java/resonantinduction/mechanical/fluid/network/FluidNetwork.java @@ -72,6 +72,7 @@ public abstract class FluidNetwork extends NodeNetwork> sideMap = new HashMap>(); - public HashMap connectionMap = new HashMap(); - public int maxFlowRate = 0; - public int maxPressure = 0; - public int currentPressure = 0; - public int currentFlowRate = 0; + public HashMap> sideMap = new HashMap>(); + public HashMap connectionMap = new HashMap(); + public int maxFlowRate = 0; + public int maxPressure = 0; + public int currentPressure = 0; + public int currentFlowRate = 0; - @Override - public void update() - { - /* - * Slight delay to allow visual effect to take place before draining the pipe's internal - * tank - */ - FluidStack stack = this.getTank().getFluid().copy(); - int count = this.sideMap.size(); + @Override + public void update() + { + /* + * Slight delay to allow visual effect to take place before draining the pipe's internal + * tank + */ + FluidStack stack = this.getTank().getFluid().copy(); + int count = this.sideMap.size(); - Iterator>> it = new HashMap>(sideMap).entrySet().iterator(); + Iterator>> it = new HashMap>(sideMap).entrySet().iterator(); - while (it.hasNext()) - { - Entry> entry = it.next(); - int sideCount = entry.getValue().size(); + while (it.hasNext()) + { + Entry> entry = it.next(); + int sideCount = entry.getValue().size(); - for (ForgeDirection dir : entry.getValue()) - { - int volPer = (stack.amount / count); - int volPerSide = (volPer / sideCount); - IFluidHandler handler = entry.getKey(); + for (ForgeDirection dir : entry.getValue()) + { + int volPer = (stack.amount / count); + int volPerSide = (volPer / sideCount); + IFluidHandler handler = entry.getKey(); - /* - * Don't input to tanks from the sides where the pipe is extraction mode. This - * prevents feed-back loops. - */ - if (connectionMap.get(handler).canFlow()) - { - stack.amount -= handler.fill(dir, FluidUtility.getStack(stack, Math.min(volPerSide, this.maxFlowRate)), true); - } + /* + * Don't input to tanks from the sides where the pipe is extraction mode. This + * prevents feed-back loops. + */ + if (connectionMap.get(handler).canFlow()) + { + stack.amount -= handler.fill(dir, FluidUtility.getStack(stack, Math.min(volPerSide, this.maxFlowRate)), true); + } - if (sideCount > 1) - --sideCount; - if (volPer <= 0) - break; - } + if (sideCount > 1) + --sideCount; + if (volPer <= 0) + break; + } - if (count > 1) - count--; + if (count > 1) + count--; - if (stack == null || stack.amount <= 0) - { - stack = null; - break; - } - } + if (stack == null || stack.amount <= 0) + { + stack = null; + break; + } + } - this.getTank().setFluid(stack); - // TODO check for change before rebuilding - this.reconstructTankInfo(); - } + this.getTank().setFluid(stack); + // TODO check for change before rebuilding + this.reconstructTankInfo(); + } - @Override - public boolean canUpdate() - { - return getTank().getFluidAmount() > 0 && sideMap.size() > 0 && getConnectors().size() > 0; - } + @Override + public boolean canUpdate() + { + return getTank().getFluidAmount() > 0 && sideMap.size() > 0 && getConnectors().size() > 0; + } - @Override - public boolean continueUpdate() - { - return canUpdate(); - } + @Override + public boolean continueUpdate() + { + return canUpdate(); + } - @Override - public void reconstruct() - { - this.sideMap.clear(); - this.maxFlowRate = Integer.MAX_VALUE; - this.maxPressure = Integer.MAX_VALUE; - super.reconstruct(); - } + @Override + public void reconstruct() + { + this.sideMap.clear(); + this.maxFlowRate = Integer.MAX_VALUE; + this.maxPressure = Integer.MAX_VALUE; + super.reconstruct(); + } - @Override - public void reconstructConnector(IFluidConnector connector) - { - super.reconstructConnector(connector); + @Override + public void reconstructConnector(IFluidConnector connector) + { + super.reconstructConnector(connector); - if (connector instanceof IFluidPipe) - { - if (((IFluidPipe) connector).getMaxFlowRate() < this.maxFlowRate) - this.maxFlowRate = ((IFluidPipe) connector).getMaxFlowRate(); + if (connector instanceof IFluidPipe) + { + if (((IFluidPipe) connector).getMaxFlowRate() < this.maxFlowRate) + this.maxFlowRate = ((IFluidPipe) connector).getMaxFlowRate(); - if (((IFluidPipe) connector).getMaxPressure() < this.maxPressure) - this.maxPressure = ((IFluidPipe) connector).getMaxPressure(); - } - for (int i = 0; i < 6; i++) - { - if (connector.getConnections()[i] instanceof IFluidHandler && !(connector.getConnections()[i] instanceof IFluidPipe)) - { - EnumSet set = this.sideMap.get(connector.getConnections()[i]); - if (set == null) - { - set = EnumSet.noneOf(ForgeDirection.class); - } + if (((IFluidPipe) connector).getMaxPressure() < this.maxPressure) + this.maxPressure = ((IFluidPipe) connector).getMaxPressure(); + } + for (int i = 0; i < 6; i++) + { + if (connector.getConnections()[i] instanceof IFluidHandler && !(connector.getConnections()[i] instanceof IFluidPipe)) + { + EnumSet set = this.sideMap.get(connector.getConnections()[i]); + if (set == null) + { + set = EnumSet.noneOf(ForgeDirection.class); + } - set.add(ForgeDirection.getOrientation(i).getOpposite()); - sideMap.put((IFluidHandler) connector.getConnections()[i], set); - connectionMap.put((IFluidHandler) connector.getConnections()[i], connector); - } - } - } + set.add(ForgeDirection.getOrientation(i).getOpposite()); + sideMap.put((IFluidHandler) connector.getConnections()[i], set); + connectionMap.put((IFluidHandler) connector.getConnections()[i], connector); + } + } + } - @Override - public FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain) - { - return null; - } + @Override + public FluidStack drain(IFluidConnector source, ForgeDirection from, FluidStack resource, boolean doDrain) + { + return null; + } - @Override - public FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain) - { - return null; - } + @Override + public FluidStack drain(IFluidConnector source, ForgeDirection from, int resource, boolean doDrain) + { + return null; + } - @Override - public Class getConnectorClass() - { - return IFluidPipe.class; - } + @Override + public Class getConnectorClass() + { + return IFluidPipe.class; + } - @Override - public IFluidNetwork newInstance() - { - return new PipeNetwork(); - } + @Override + public IFluidNetwork newInstance() + { + return new PipeNetwork(); + } - @Override - public int getPressure() - { - return this.currentPressure; - } + @Override + public int getPressure() + { + return this.currentPressure; + } } diff --git a/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java b/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java index 0cb940231..cc6f3a1ab 100644 --- a/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java +++ b/src/main/java/resonantinduction/mechanical/fluid/pipe/PartPipe.java @@ -27,210 +27,210 @@ import cpw.mods.fml.relauncher.SideOnly; public class PartPipe extends PartFramedConnection implements IFluidPipe, TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects { - protected FluidTank tank = new FluidTank(1 * FluidContainerRegistry.BUCKET_VOLUME); - private boolean isExtracting = false; + protected FluidTank tank = new FluidTank(1 * FluidContainerRegistry.BUCKET_VOLUME); + private boolean isExtracting = false; - public PartPipe() - { - super(); - material = EnumPipeMaterial.COPPER; - } + public PartPipe() + { + super(); + material = EnumPipeMaterial.COPPER; + } - public PartPipe(int typeID) - { - material = EnumPipeMaterial.values()[typeID]; - } + public PartPipe(int typeID) + { + material = EnumPipeMaterial.values()[typeID]; + } - @Override - public String getType() - { - return "resonant_induction_pipe"; - } + @Override + public String getType() + { + return "resonant_induction_pipe"; + } - @Override - public void update() - { - if (!world().isRemote) - { - if (isExtracting && getNetwork().getTank().getFluidAmount() < getNetwork().getTank().getCapacity()) - { - for (int i = 0; i < this.getConnections().length; i++) - { - Object obj = this.getConnections()[i]; + @Override + public void update() + { + if (!world().isRemote) + { + if (isExtracting && getNetwork().getTank().getFluidAmount() < getNetwork().getTank().getCapacity()) + { + for (int i = 0; i < this.getConnections().length; i++) + { + Object obj = this.getConnections()[i]; - if (obj instanceof IFluidHandler) - { - FluidStack drain = ((IFluidHandler) obj).drain(ForgeDirection.getOrientation(i).getOpposite(), getMaxFlowRate(), true); - fill(null, drain, true); - } - } - } - } - } + if (obj instanceof IFluidHandler) + { + FluidStack drain = ((IFluidHandler) obj).drain(ForgeDirection.getOrientation(i).getOpposite(), getMaxFlowRate(), true); + fill(null, drain, true); + } + } + } + } + } - @Override - public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item) - { - if (BlockAdvanced.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z())) - { - if (!world().isRemote) - { - isExtracting = !isExtracting; - player.addChatMessage("Pipe extraction mode: " + isExtracting); - BlockAdvanced.damageWrench(player, player.getCurrentEquippedItem(), x(), y(), z()); - } - return true; - } + @Override + public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item) + { + if (BlockAdvanced.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z())) + { + if (!world().isRemote) + { + isExtracting = !isExtracting; + player.addChatMessage("Pipe extraction mode: " + isExtracting); + BlockAdvanced.damageWrench(player, player.getCurrentEquippedItem(), x(), y(), z()); + } + return true; + } - return super.activate(player, part, item); - } + return super.activate(player, part, item); + } - @Override - @SideOnly(Side.CLIENT) - public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass) - { - RenderPipe.INSTANCE.render(this, pos.x, pos.y, pos.z, frame); - } + @Override + @SideOnly(Side.CLIENT) + public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass) + { + RenderPipe.INSTANCE.render(this, pos.x, pos.y, pos.z, frame); + } - @Override - public void setMaterial(int i) - { - setMaterial(EnumPipeMaterial.values()[i]); - } + @Override + public void setMaterial(int i) + { + setMaterial(EnumPipeMaterial.values()[i]); + } - @Override - protected ItemStack getItem() - { - return new ItemStack(Mechanical.itemPipe); - } + @Override + protected ItemStack getItem() + { + return new ItemStack(Mechanical.itemPipe); + } - /** Fluid network methods. */ - @Override - public IFluidNetwork getNetwork() - { - if (this.network == null) - { - this.network = new PipeNetwork(); - this.network.addConnector(this); - } - return this.network; - } + /** Fluid network methods. */ + @Override + public IFluidNetwork getNetwork() + { + if (this.network == null) + { + this.network = new PipeNetwork(); + this.network.addConnector(this); + } + return this.network; + } - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - return getNetwork().fill(this, from, resource, doFill); - } + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + { + return getNetwork().fill(this, from, resource, doFill); + } - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - return null; - } + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + { + return null; + } - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - return null; - } + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) + { + return null; + } - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) - { - return true; - } + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) + { + return true; + } - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) - { - return true; - } + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) + { + return true; + } - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { - return this.getNetwork().getTankInfo(); - } + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) + { + return this.getNetwork().getTankInfo(); + } - @Override - public void onFluidChanged() - { - } + @Override + public void onFluidChanged() + { + } - @Override - public FluidTank getInternalTank() - { - if (this.tank == null) - { - this.tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); - } - return this.tank; - } + @Override + public FluidTank getInternalTank() + { + if (this.tank == null) + { + this.tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); + } + return this.tank; + } - @Override - protected boolean canConnectTo(TileEntity tile) - { - return tile instanceof IFluidHandler; - } + @Override + protected boolean canConnectTo(TileEntity tile) + { + return tile instanceof IFluidHandler; + } - @Override - protected IFluidPipe getConnector(TileEntity tile) - { - return tile instanceof IFluidPipe ? (IFluidPipe) tile : null; - } + @Override + protected IFluidPipe getConnector(TileEntity tile) + { + return tile instanceof IFluidPipe ? (IFluidPipe) tile : null; + } - @Override - public int getPressureIn(ForgeDirection side) - { - return 0; - } + @Override + public int getPressureIn(ForgeDirection side) + { + return 0; + } - @Override - public int getPressure() - { - if(this.getNetwork() != null) - { - return this.getNetwork().getPressure(); - } - return 0; - } + @Override + public int getPressure() + { + if (this.getNetwork() != null) + { + return this.getNetwork().getPressure(); + } + return 0; + } - @Override - public void onWrongPressure(ForgeDirection side, int pressure) - { + @Override + public void onWrongPressure(ForgeDirection side, int pressure) + { - } + } - @Override - public int getMaxPressure() - { - return 1000; - } + @Override + public int getMaxPressure() + { + return 1000; + } - @Override - public int getMaxFlowRate() - { - return FluidContainerRegistry.BUCKET_VOLUME; - } + @Override + public int getMaxFlowRate() + { + return FluidContainerRegistry.BUCKET_VOLUME; + } - @Override - public void save(NBTTagCompound nbt) - { - super.save(nbt); - nbt.setBoolean("isExtracting", isExtracting); - } + @Override + public void save(NBTTagCompound nbt) + { + super.save(nbt); + nbt.setBoolean("isExtracting", isExtracting); + } - @Override - public void load(NBTTagCompound nbt) - { - super.load(nbt); - isExtracting = nbt.getBoolean("isExtracting"); - } + @Override + public void load(NBTTagCompound nbt) + { + super.load(nbt); + isExtracting = nbt.getBoolean("isExtracting"); + } - @Override - public boolean canFlow() - { - return !isExtracting; - } + @Override + public boolean canFlow() + { + return !isExtracting; + } } \ No newline at end of file diff --git a/src/main/java/resonantinduction/mechanical/fluid/tank/TankNetwork.java b/src/main/java/resonantinduction/mechanical/fluid/tank/TankNetwork.java index 47191b69d..ff3385968 100644 --- a/src/main/java/resonantinduction/mechanical/fluid/tank/TankNetwork.java +++ b/src/main/java/resonantinduction/mechanical/fluid/tank/TankNetwork.java @@ -9,76 +9,79 @@ import resonantinduction.api.fluid.IFluidConnector; import resonantinduction.api.fluid.IFluidNetwork; import resonantinduction.mechanical.fluid.network.FluidNetwork; -/** Network that handles connected tanks +/** + * Network that handles connected tanks * - * @author DarkGuardsman */ + * @author DarkGuardsman + */ public class TankNetwork extends FluidNetwork { - @Override - public void distributeConnectors() - { - FluidStack fillStack = this.getTank().getFluid(); - int lowestY = 255, highestY = 0; + @Override + public void distributeConnectors() + { + FluidStack fillStack = this.getTank().getFluid(); + int lowestY = 255, highestY = 0; - if (fillStack == null || fillStack.getFluid().isGaseous()) - { - super.distributeConnectors(); - } - else if (this.getConnectors().size() > 0) - { - fillStack = fillStack.copy(); + if (fillStack == null || fillStack.getFluid().isGaseous()) + { + super.distributeConnectors(); + } + else if (this.getConnectors().size() > 0) + { + fillStack = fillStack.copy(); - for (IFluidConnector connector : this.getConnectors()) - { - connector.getInternalTank().setFluid(null); - connector.onFluidChanged(); + for (IFluidConnector connector : this.getConnectors()) + { + connector.getInternalTank().setFluid(null); + connector.onFluidChanged(); - if (connector instanceof TileEntity && ((TileEntity) connector).yCoord < lowestY) - { - lowestY = ((TileEntity) connector).yCoord; - } - if (connector instanceof TileEntity && ((TileEntity) connector).yCoord > highestY) - { - highestY = ((TileEntity) connector).yCoord; - } - } + if (connector instanceof TileEntity && ((TileEntity) connector).yCoord < lowestY) + { + lowestY = ((TileEntity) connector).yCoord; + } + if (connector instanceof TileEntity && ((TileEntity) connector).yCoord > highestY) + { + highestY = ((TileEntity) connector).yCoord; + } + } - // TODO Add path finder to prevent filling when tanks are only connected at the top - for (int y = lowestY; y <= highestY; y++) - { - Set parts = new LinkedHashSet(); + // TODO Add path finder to prevent filling when tanks are only connected at the top + for (int y = lowestY; y <= highestY; y++) + { + Set parts = new LinkedHashSet(); - for (IFluidConnector part : this.getConnectors()) - { - if (part instanceof IFluidConnector && ((TileEntity) part).yCoord == y) - { - parts.add(part); - } - } - if (!parts.isEmpty()) - { - this.fillTankSet(fillStack, parts); - } + for (IFluidConnector part : this.getConnectors()) + { + if (part instanceof IFluidConnector && ((TileEntity) part).yCoord == y) + { + parts.add(part); + } + } + if (!parts.isEmpty()) + { + this.fillTankSet(fillStack, parts); + } - if (fillStack == null || fillStack.amount <= 0) - { - break; - } - } - } - } + if (fillStack == null || fillStack.amount <= 0) + { + break; + } + } + } + } - @Override - public IFluidNetwork newInstance() - { - return new TankNetwork(); - } + @Override + public IFluidNetwork newInstance() + { + return new TankNetwork(); + } - @Override - public int getPressure() - { - //TODO implement a compression system that would cause a tank to build up pressure greater than normal ATM - return 0; - } + @Override + public int getPressure() + { + // TODO implement a compression system that would cause a tank to build up pressure greater + // than normal ATM + return 0; + } } diff --git a/src/main/java/resonantinduction/mechanical/gear/GearMultiBlockHandler.java b/src/main/java/resonantinduction/mechanical/gear/GearMultiBlockHandler.java index 44575fc58..060b95802 100644 --- a/src/main/java/resonantinduction/mechanical/gear/GearMultiBlockHandler.java +++ b/src/main/java/resonantinduction/mechanical/gear/GearMultiBlockHandler.java @@ -14,6 +14,7 @@ public class GearMultiBlockHandler extends MultiBlockHandler super(wrapper); } + @Override public PartGear getWrapperAt(Vector3 position) { TileEntity tile = position.getTileEntity(self.getWorld()); diff --git a/src/main/java/resonantinduction/mechanical/gear/ItemGear.java b/src/main/java/resonantinduction/mechanical/gear/ItemGear.java index cb76157fd..42bdfafc2 100644 --- a/src/main/java/resonantinduction/mechanical/gear/ItemGear.java +++ b/src/main/java/resonantinduction/mechanical/gear/ItemGear.java @@ -10,7 +10,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; import resonantinduction.core.Settings; import resonantinduction.core.prefab.part.ItemMultipartBase; -import resonantinduction.electrical.wire.EnumWireMaterial; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Vector3; import codechicken.multipart.ControlKeyModifer; diff --git a/src/main/java/resonantinduction/mechanical/gear/PartGear.java b/src/main/java/resonantinduction/mechanical/gear/PartGear.java index 94ade8a6a..46ab970b7 100644 --- a/src/main/java/resonantinduction/mechanical/gear/PartGear.java +++ b/src/main/java/resonantinduction/mechanical/gear/PartGear.java @@ -104,6 +104,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock getMultiBlock().update(); } + @Override public void checkClientUpdate() { if (getMultiBlock().isPrimary()) @@ -149,6 +150,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock /** * Refresh should be called sparingly. */ + @Override public void refresh() { connections = new Object[6]; @@ -215,7 +217,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock if (connections[checkDir.ordinal()] == null && checkTile instanceof IMechanical) { - IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(placementSide); + IMechanical instance = ((IMechanical) checkTile).getInstance(placementSide); if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && !(instance instanceof PartGearShaft)) { diff --git a/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java b/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java index 0c839c3d2..0f81bc1d7 100644 --- a/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java +++ b/src/main/java/resonantinduction/mechanical/gear/PartGearShaft.java @@ -1,6 +1,5 @@ package resonantinduction.mechanical.gear; -import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -13,7 +12,6 @@ import resonantinduction.mechanical.network.IMechanical; import resonantinduction.mechanical.network.PartMechanical; import codechicken.lib.raytracer.IndexedCuboid6; import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Rotation; import codechicken.lib.vec.Vector3; import codechicken.multipart.PartMap; import cpw.mods.fml.relauncher.Side; @@ -40,6 +38,7 @@ public class PartGearShaft extends PartMechanical sides[6] = new IndexedCuboid6(6, new Cuboid6(0.36, 0.36, 0.36, 0.64, 0.64, 0.64)); } + @Override public void preparePlacement(int side, int itemDamage) { ForgeDirection dir = ForgeDirection.getOrientation((byte) (side ^ 1)); @@ -63,6 +62,7 @@ public class PartGearShaft extends PartMechanical /** * Refresh should be called sparingly. */ + @Override public void refresh() { connections = new Object[6]; @@ -95,7 +95,7 @@ public class PartGearShaft extends PartMechanical if (checkTile instanceof IMechanical) { - IMechanical instance = (IMechanical) ((IMechanical) checkTile).getInstance(checkDir.getOpposite()); + IMechanical instance = ((IMechanical) checkTile).getInstance(checkDir.getOpposite()); // Only connect to shafts outside of this block space. if (instance != null && instance != this && instance instanceof PartGearShaft && instance.canConnect(checkDir.getOpposite(), this)) diff --git a/src/main/java/resonantinduction/mechanical/gear/RenderGear.java b/src/main/java/resonantinduction/mechanical/gear/RenderGear.java index 6552e6e75..39cf38629 100644 --- a/src/main/java/resonantinduction/mechanical/gear/RenderGear.java +++ b/src/main/java/resonantinduction/mechanical/gear/RenderGear.java @@ -2,7 +2,6 @@ package resonantinduction.mechanical.gear; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; @@ -10,7 +9,6 @@ import org.lwjgl.opengl.GL11; import resonantinduction.core.Reference; import calclavia.lib.render.RenderUtility; -import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/mechanical/gear/RenderGearShaft.java b/src/main/java/resonantinduction/mechanical/gear/RenderGearShaft.java index 125205a21..c754a55cd 100644 --- a/src/main/java/resonantinduction/mechanical/gear/RenderGearShaft.java +++ b/src/main/java/resonantinduction/mechanical/gear/RenderGearShaft.java @@ -11,7 +11,6 @@ import org.lwjgl.opengl.GL11; import resonantinduction.core.Reference; import calclavia.lib.render.RenderUtility; -import calclavia.lib.utility.WorldUtility; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/mechanical/motor/BlockFluidMotor.java b/src/main/java/resonantinduction/mechanical/motor/BlockFluidMotor.java index af88f7523..d8cd87816 100644 --- a/src/main/java/resonantinduction/mechanical/motor/BlockFluidMotor.java +++ b/src/main/java/resonantinduction/mechanical/motor/BlockFluidMotor.java @@ -3,81 +3,81 @@ package resonantinduction.mechanical.motor; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import resonantinduction.core.Reference; import resonantinduction.core.prefab.block.BlockRIRotatable; import resonantinduction.core.render.RIBlockRenderingHandler; import resonantinduction.electrical.generator.TileGenerator; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockFluidMotor extends BlockRIRotatable { - public BlockFluidMotor() - { - super("FluidMotor"); - setTextureName(Reference.PREFIX + "material_steel"); - rotationMask = Byte.parseByte("111111", 2); - } + public BlockFluidMotor() + { + super("FluidMotor"); + setTextureName(Reference.PREFIX + "material_steel"); + rotationMask = Byte.parseByte("111111", 2); + } - @Override - public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) - { - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + @Override + public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - if (tileEntity instanceof TileGenerator) - { - if (!world.isRemote) - { - ((TileGenerator) tileEntity).isInversed = !((TileGenerator) tileEntity).isInversed; - entityPlayer.addChatMessage("Generator now producing " + (((TileGenerator) tileEntity).isInversed ? "mechanical" : "electrical") + " energy."); - } + if (tileEntity instanceof TileGenerator) + { + if (!world.isRemote) + { + ((TileGenerator) tileEntity).isInversed = !((TileGenerator) tileEntity).isInversed; + entityPlayer.addChatMessage("Generator now producing " + (((TileGenerator) tileEntity).isInversed ? "mechanical" : "electrical") + " energy."); + } - return true; - } + return true; + } - return false; - } + return false; + } - @Override - public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) - { - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + @Override + public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) + { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - if (tileEntity instanceof TileGenerator) - { - if (!world.isRemote) - { - entityPlayer.addChatMessage("Generator torque ratio: " + ((TileGenerator) tileEntity).toggleRatio()); - } + if (tileEntity instanceof TileGenerator) + { + if (!world.isRemote) + { + entityPlayer.addChatMessage("Generator torque ratio: " + ((TileGenerator) tileEntity).toggleRatio()); + } - return true; - } - return false; - } + return true; + } + return false; + } - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileGenerator(); - } + @Override + public TileEntity createNewTileEntity(World world) + { + return new TileGenerator(); + } - @Override - public boolean isOpaqueCube() - { - return false; - } + @Override + public boolean isOpaqueCube() + { + return false; + } - @Override - public boolean renderAsNormalBlock() - { - return false; - } + @Override + public boolean renderAsNormalBlock() + { + return false; + } - @SideOnly(Side.CLIENT) - @Override - public int getRenderType() - { - return RIBlockRenderingHandler.ID; - } + @SideOnly(Side.CLIENT) + @Override + public int getRenderType() + { + return RIBlockRenderingHandler.ID; + } } diff --git a/src/main/java/resonantinduction/mechanical/motor/TileFluidMotor.java b/src/main/java/resonantinduction/mechanical/motor/TileFluidMotor.java index 446e7682c..72b446ca8 100644 --- a/src/main/java/resonantinduction/mechanical/motor/TileFluidMotor.java +++ b/src/main/java/resonantinduction/mechanical/motor/TileFluidMotor.java @@ -13,91 +13,91 @@ import calclavia.lib.prefab.tile.TileAdvanced; public class TileFluidMotor extends TileAdvanced implements IFluidHandler, IRotatable { - ForgeDirection facing = ForgeDirection.UNKNOWN; - boolean input = true; - final int maxFlow = 1000; - int volFilled = 0; - int averageVol = 0; + ForgeDirection facing = ForgeDirection.UNKNOWN; + boolean input = true; + final int maxFlow = 1000; + int volFilled = 0; + int averageVol = 0; - @Override - public void updateEntity() - { - super.updateEntity(); - } + @Override + public void updateEntity() + { + super.updateEntity(); + } - @Override - public int fill(ForgeDirection from, FluidStack resource, boolean doFill) - { - if (from == getDirection().getOpposite()) - { - TileEntity tileOut = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj); - TileEntity tileIn = new Vector3(this).translate(from).getTileEntity(this.worldObj); - if (tileIn instanceof IFluidPipe && tileOut instanceof IFluidPipe) - { - if (((IFluidPipe) tileIn).getPressure() <= ((IFluidPipe) tileOut).getPressure()) - { - return 0; - } - } - if (tileOut instanceof IFluidHandler && !(tileOut instanceof TileFluidMotor)) - { - //TODO pass fluid on to the other side of the motor and get average flow rate - } - } - return 0; - } + @Override + public int fill(ForgeDirection from, FluidStack resource, boolean doFill) + { + if (from == getDirection().getOpposite()) + { + TileEntity tileOut = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj); + TileEntity tileIn = new Vector3(this).translate(from).getTileEntity(this.worldObj); + if (tileIn instanceof IFluidPipe && tileOut instanceof IFluidPipe) + { + if (((IFluidPipe) tileIn).getPressure() <= ((IFluidPipe) tileOut).getPressure()) + { + return 0; + } + } + if (tileOut instanceof IFluidHandler && !(tileOut instanceof TileFluidMotor)) + { + // TODO pass fluid on to the other side of the motor and get average flow rate + } + } + return 0; + } - @Override - public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) - { - // TODO Auto-generated method stub - return null; - } + @Override + public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) + { + // TODO Auto-generated method stub + return null; + } - @Override - public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - // TODO Auto-generated method stub - return null; - } + @Override + public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) + { + // TODO Auto-generated method stub + return null; + } - @Override - public boolean canFill(ForgeDirection from, Fluid fluid) - { - return !input && from == this.getDirection().getOpposite(); - } + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) + { + return !input && from == this.getDirection().getOpposite(); + } - @Override - public boolean canDrain(ForgeDirection from, Fluid fluid) - { - // TODO Auto-generated method stub - return false; - } + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) + { + // TODO Auto-generated method stub + return false; + } - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection from) - { - if (from == getDirection().getOpposite()) - { - TileEntity tile = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj); - if (tile instanceof IFluidHandler && !(tile instanceof TileFluidMotor)) - { - return ((IFluidHandler) tile).getTankInfo(from); - } - } - return new FluidTankInfo[1]; - } + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection from) + { + if (from == getDirection().getOpposite()) + { + TileEntity tile = new Vector3(this).translate(from.getOpposite()).getTileEntity(this.worldObj); + if (tile instanceof IFluidHandler && !(tile instanceof TileFluidMotor)) + { + return ((IFluidHandler) tile).getTankInfo(from); + } + } + return new FluidTankInfo[1]; + } - @Override - public ForgeDirection getDirection() - { - return ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); - } + @Override + public ForgeDirection getDirection() + { + return ForgeDirection.getOrientation(this.worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); + } - @Override - public void setDirection(ForgeDirection direction) - { - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), 3); - } + @Override + public void setDirection(ForgeDirection direction) + { + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), 3); + } } diff --git a/src/main/java/resonantinduction/mechanical/network/IMechanical.java b/src/main/java/resonantinduction/mechanical/network/IMechanical.java index 97dea6f61..0f75c0624 100644 --- a/src/main/java/resonantinduction/mechanical/network/IMechanical.java +++ b/src/main/java/resonantinduction/mechanical/network/IMechanical.java @@ -23,6 +23,7 @@ public interface IMechanical extends IConnector public boolean inverseRotation(ForgeDirection dir, IMechanical with); + @Override public IMechanical getInstance(ForgeDirection dir); /** diff --git a/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java b/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java index ebaa14149..0419d988e 100644 --- a/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java +++ b/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java @@ -7,7 +7,6 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import net.minecraftforge.common.ForgeDirection; -import resonantinduction.mechanical.gear.PartGearShaft; import universalelectricity.api.net.IUpdate; import universalelectricity.core.net.Network; import universalelectricity.core.net.NetworkTickHandler; @@ -136,7 +135,7 @@ public class MechanicalNetwork extends Network if (deltaTime > 1) { - rotation = (float) (((velocity) * ((double) deltaTime / 1000d) + rotation) % (2 * Math.PI)); + rotation = (float) (((velocity) * (deltaTime / 1000d) + rotation) % (2 * Math.PI)); lastRotateTime = System.currentTimeMillis(); } diff --git a/src/main/java/resonantinduction/mechanical/network/PacketNetwork.java b/src/main/java/resonantinduction/mechanical/network/PacketNetwork.java index 9596b6efb..657a95e5f 100644 --- a/src/main/java/resonantinduction/mechanical/network/PacketNetwork.java +++ b/src/main/java/resonantinduction/mechanical/network/PacketNetwork.java @@ -53,13 +53,13 @@ public class PacketNetwork extends PacketType int y = data.readInt(); int z = data.readInt(); TileEntity tileEntity = player.worldObj.getBlockTileEntity(x, y, z); - System.out.println(tileEntity+" rec: "+new Vector3(x,y,z)); - //TODO: Somehow this would receive the wrong coordinate once in a while... + System.out.println(tileEntity + " rec: " + new Vector3(x, y, z)); + // TODO: Somehow this would receive the wrong coordinate once in a while... if (tileEntity != null && connectorClass.isAssignableFrom(tileEntity.getClass())) { C instance = (C) ((C) tileEntity).getInstance(ForgeDirection.getOrientation(data.readInt())); Object network = instance.getNetwork(); - + if (network instanceof IPacketReceiver) { ((IPacketReceiver) network).onReceivePacket(data, player, instance); diff --git a/src/main/java/resonantinduction/mechanical/network/PartMechanical.java b/src/main/java/resonantinduction/mechanical/network/PartMechanical.java index 2c59adf7d..433695622 100644 --- a/src/main/java/resonantinduction/mechanical/network/PartMechanical.java +++ b/src/main/java/resonantinduction/mechanical/network/PartMechanical.java @@ -1,7 +1,6 @@ package resonantinduction.mechanical.network; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import net.minecraft.entity.player.EntityPlayer; @@ -11,11 +10,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.ForgeDirection; import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataOutput; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Vector3; -import codechicken.microblock.FaceMicroClass; import codechicken.multipart.JCuboidPart; import codechicken.multipart.JNormalOcclusion; import codechicken.multipart.TFacePart; diff --git a/src/main/java/resonantinduction/mechanical/network/TileMechanical.java b/src/main/java/resonantinduction/mechanical/network/TileMechanical.java index f5a8d2c5e..e0b9a36a6 100644 --- a/src/main/java/resonantinduction/mechanical/network/TileMechanical.java +++ b/src/main/java/resonantinduction/mechanical/network/TileMechanical.java @@ -1,7 +1,5 @@ package resonantinduction.mechanical.network; -import com.google.common.io.ByteArrayDataInput; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -13,6 +11,8 @@ import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.PacketHandler; import calclavia.lib.prefab.tile.TileAdvanced; +import com.google.common.io.ByteArrayDataInput; + public abstract class TileMechanical extends TileAdvanced implements IMechanical, IPacketReceiver { /** The mechanical connections this connector has made */ diff --git a/src/main/java/resonantinduction/mechanical/process/BlockFilter.java b/src/main/java/resonantinduction/mechanical/process/BlockFilter.java index 3d0d072bb..9f4d7dfe1 100644 --- a/src/main/java/resonantinduction/mechanical/process/BlockFilter.java +++ b/src/main/java/resonantinduction/mechanical/process/BlockFilter.java @@ -55,50 +55,50 @@ public class BlockFilter extends BlockRI implements ITileEntityProvider * Leak the fluid down. */ /* - BlockFluidMixture fluidBlock = (BlockFluidMixture) ResonantInduction.blockFluidMixture; - int amount = fluidBlock.getQuantaValue(world, x, y, z); - - /** + * BlockFluidMixture fluidBlock = (BlockFluidMixture) + * ResonantInduction.blockFluidMixture; + * int amount = fluidBlock.getQuantaValue(world, x, y, z); + * /** * All fluid is filtered out, spawn all the items. - * - if (amount <= 1) - { - System.out.println("filter dropped"); - for (ItemStack itemStack : ((TileFluidMixture) tileAbove).items) - { - for (Resource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, itemStack)) - { - InventoryUtility.dropItemStack(world, checkAbove.clone().add(0.5), resoure.getItemStack().copy()); - } - } - } - - int remaining = amount - 1; - - /** + * if (amount <= 1) + * { + * System.out.println("filter dropped"); + * for (ItemStack itemStack : ((TileFluidMixture) tileAbove).items) + * { + * for (Resource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, + * itemStack)) + * { + * InventoryUtility.dropItemStack(world, checkAbove.clone().add(0.5), + * resoure.getItemStack().copy()); + * } + * } + * } + * int remaining = amount - 1; + * /** * Remove liquid from top. - * - if (remaining > 0) - { - fluidBlock.setQuanta(world, checkAbove.intX(), checkAbove.intY(), checkAbove.intZ(), remaining); - world.scheduleBlockUpdate(x, y, z, blockID, 20); - } - else - { - checkAbove.setBlock(world, 0); - } - - /** + * if (remaining > 0) + * { + * fluidBlock.setQuanta(world, checkAbove.intX(), checkAbove.intY(), + * checkAbove.intZ(), remaining); + * world.scheduleBlockUpdate(x, y, z, blockID, 20); + * } + * else + * { + * checkAbove.setBlock(world, 0); + * } + * /** * Add liquid to bottom. - * - if (checkBelow.getBlockID(world) == ResonantInduction.blockFluidMixture.blockID) - { - fluidBlock.setQuanta(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ(), fluidBlock.getQuantaValue(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()) + 1); - } - else - { - checkBelow.setBlock(world, Block.waterStill.blockID, 3); - }*/ + * if (checkBelow.getBlockID(world) == ResonantInduction.blockFluidMixture.blockID) + * { + * fluidBlock.setQuanta(world, checkBelow.intX(), checkBelow.intY(), + * checkBelow.intZ(), fluidBlock.getQuantaValue(world, checkBelow.intX(), + * checkBelow.intY(), checkBelow.intZ()) + 1); + * } + * else + * { + * checkBelow.setBlock(world, Block.waterStill.blockID, 3); + * } + */ } } } diff --git a/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java b/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java index 8d39fd036..ea540e484 100644 --- a/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java +++ b/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java @@ -1,14 +1,12 @@ package resonantinduction.mechanical.process; -import org.apache.commons.lang3.ArrayUtils; - -import com.google.common.io.ByteArrayDataInput; - import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeDirection; + +import org.apache.commons.lang3.ArrayUtils; + import resonantinduction.api.recipe.MachineRecipes; import resonantinduction.api.recipe.MachineRecipes.RecipeType; import resonantinduction.api.recipe.RecipeUtils.Resource; diff --git a/src/main/java/resonantinduction/mechanical/process/TileMixer.java b/src/main/java/resonantinduction/mechanical/process/TileMixer.java index eee05be14..5755ac26a 100644 --- a/src/main/java/resonantinduction/mechanical/process/TileMixer.java +++ b/src/main/java/resonantinduction/mechanical/process/TileMixer.java @@ -13,7 +13,6 @@ import net.minecraftforge.common.ForgeDirection; import resonantinduction.api.recipe.MachineRecipes; import resonantinduction.api.recipe.MachineRecipes.RecipeType; import resonantinduction.core.Reference; -import resonantinduction.core.ResonantInduction; import resonantinduction.core.resource.fluid.TileFluidMixture; import resonantinduction.mechanical.fluid.tank.TileTank; import resonantinduction.mechanical.network.TileMechanical; diff --git a/src/main/java/resonantinduction/mechanical/turbine/BlockWindTurbine.java b/src/main/java/resonantinduction/mechanical/turbine/BlockWindTurbine.java index 8fdb10411..4366848b5 100644 --- a/src/main/java/resonantinduction/mechanical/turbine/BlockWindTurbine.java +++ b/src/main/java/resonantinduction/mechanical/turbine/BlockWindTurbine.java @@ -7,9 +7,7 @@ import resonantinduction.core.Reference; import resonantinduction.core.Settings; import resonantinduction.core.TabRI; import resonantinduction.core.render.RIBlockRenderingHandler; -import resonantinduction.mechanical.network.IMechanical; import calclavia.lib.prefab.turbine.BlockTurbine; -import calclavia.lib.prefab.turbine.TileTurbine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/resonantinduction/mechanical/turbine/RenderWindTurbine.java b/src/main/java/resonantinduction/mechanical/turbine/RenderWindTurbine.java index 15f5119cb..0fd2b3a82 100644 --- a/src/main/java/resonantinduction/mechanical/turbine/RenderWindTurbine.java +++ b/src/main/java/resonantinduction/mechanical/turbine/RenderWindTurbine.java @@ -2,7 +2,6 @@ package resonantinduction.mechanical.turbine; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; @@ -35,7 +34,7 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer { RenderUtility.rotateBlockBasedOnDirectionUp(tile.getDirection()); } - + GL11.glRotatef((float) Math.toDegrees(tile.rotation), 0, 1, 0); /** diff --git a/src/main/java/resonantinduction/mechanical/turbine/TileWindTurbine.java b/src/main/java/resonantinduction/mechanical/turbine/TileWindTurbine.java index caa5a2c67..ead101dcb 100644 --- a/src/main/java/resonantinduction/mechanical/turbine/TileWindTurbine.java +++ b/src/main/java/resonantinduction/mechanical/turbine/TileWindTurbine.java @@ -64,7 +64,7 @@ public class TileWindTurbine extends TileTurbine implements IMechanical { BiomeGenBase biome = worldObj.getBiomeGenForCoords(xCoord, zCoord); boolean hasBonus = biome instanceof BiomeGenOcean || biome instanceof BiomeGenPlains || biome == BiomeGenBase.river; - return (long) (worldObj.canBlockSeeTheSky(xCoord, yCoord + 4, zCoord) ? (((float) yCoord + 4) / (float) 256) * 5 : 0) + (hasBonus ? 10 : 0); + return (long) (worldObj.canBlockSeeTheSky(xCoord, yCoord + 4, zCoord) ? (((float) yCoord + 4) / 256) * 5 : 0) + (hasBonus ? 10 : 0); } @Override