From 83d545e3c7cd960662d027af4e29740854fccda8 Mon Sep 17 00:00:00 2001 From: mezz Date: Mon, 29 Sep 2014 16:23:47 -0700 Subject: [PATCH] automatic spaces to tabs --- build.gradle | 14 +- .../apiculture/entities/EntityBee.java | 33 ++--- .../render/FruitPodRenderingHandler.java | 24 ++-- .../render/SaplingRenderHandler.java | 8 +- .../forestry/core/fluids/tanks/FakeTank.java | 31 +++-- .../core/gadgets/BlockStainedGlass.java | 4 +- .../core/gui/buttons/ButtonTextureSet.java | 49 ++++--- .../core/gui/buttons/GuiButtonSmall.java | 14 +- .../gui/buttons/GuiToggleButtonSmall.java | 16 +-- .../core/gui/buttons/IButtonTextureSet.java | 11 +- .../core/gui/buttons/IMultiButtonState.java | 11 +- .../core/gui/buttons/LockButtonState.java | 41 +++--- .../buttons/StandardButtonTextureSets.java | 63 +++++---- .../forestry/core/gui/slots/SlotCrafter.java | 8 +- .../core/gui/slots/SlotItemInventory.java | 12 +- .../forestry/core/gui/tooltips/ToolTip.java | 89 +++++++------ .../forestry/core/inventory/ITileFilter.java | 5 +- .../core/inventory/InventorySorter.java | 15 +-- .../core/inventory/ItemStackSizeSorter.java | 30 ++--- .../inventory/filters/ArrayStackFilter.java | 47 ++++--- .../filters/InvertedStackFilter.java | 25 ++-- .../manipulators/InventoryManipulator.java | 84 ++++++------ .../core/inventory/wrappers/IInvSlot.java | 19 ++- .../inventory/wrappers/InventoryIterator.java | 120 +++++++++--------- .../wrappers/SidedInventoryIterator.java | 110 ++++++++-------- .../java/forestry/core/triggers/Trigger.java | 11 +- src/main/java/forestry/core/utils/Fluids.java | 51 ++++---- .../java/forestry/core/utils/NBTUtil.java | 89 ++++++------- .../forestry/pipes/PipeItemsPropolis.java | 117 ++++++++--------- .../java/forestry/pipes/proxy/ProxyPipes.java | 52 ++++---- 30 files changed, 596 insertions(+), 607 deletions(-) diff --git a/build.gradle b/build.gradle index c95e1c937..1fb8f5512 100755 --- a/build.gradle +++ b/build.gradle @@ -78,9 +78,9 @@ dependencies { processResources { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { @@ -173,7 +173,7 @@ jar { destinationDir = file("build/tmp") archiveName = "main.jar" - from { + from { configurations.apis.collect { it.isDirectory() ? it : zipTree(it).matching { include '**/api/**' @@ -211,7 +211,7 @@ task mainJar ( type: Zip, dependsOn: mainJarSigned ) { from (zipTree(jar.getArchivePath())) { include '**' - exclude '**/codechicken/**' + exclude '**/codechicken/**' } duplicatesStrategy = DuplicatesStrategy.EXCLUDE @@ -248,12 +248,12 @@ task devJar ( type: Zip, dependsOn: devJarSigned ) { from(sourceSets.main.allSource) { include '**' - exclude '**/codechicken/**' + exclude '**/codechicken/**' } from(sourceSets.main.output) { include '**' - exclude '**/codechicken/**' + exclude '**/codechicken/**' } from { diff --git a/src/main/java/forestry/apiculture/entities/EntityBee.java b/src/main/java/forestry/apiculture/entities/EntityBee.java index dfc096643..d5716ddb5 100755 --- a/src/main/java/forestry/apiculture/entities/EntityBee.java +++ b/src/main/java/forestry/apiculture/entities/EntityBee.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -28,13 +28,13 @@ import forestry.plugins.PluginApiculture; public class EntityBee extends EntityCreature implements IAnimals { private static final String DEFAULT_TEXTURE = Defaults.TEXTURE_PATH_ENTITIES + "/bees/honeyBee.png"; - + IBee contained; IAlleleBeeSpecies species; EnumBeeType type = EnumBeeType.DRONE; - - private String beeTexture = DEFAULT_TEXTURE; - private long lastUpdate; + + private String beeTexture = DEFAULT_TEXTURE; + private long lastUpdate; public EntityBee(World world) { super(world); @@ -43,49 +43,50 @@ public class EntityBee extends EntityCreature implements IAnimals { private void resetAppearance() { beeTexture = species.getEntityTexture(); } - + public EntityBee setIndividual(IBee bee) { - if(bee != null) + if (bee != null) contained = bee; else contained = PluginApiculture.beeInterface.templateAsIndividual(PluginApiculture.beeInterface.getDefaultTemplate()); - + //isImmuneToFire = contained.getGenome().getFireResist(); setSpecies(contained.getGenome().getPrimary()); //dataWatcher.updateObject(DATAWATCHER_ID_SPECIES, species.getUID()); //dataWatcher.updateObject(DATAWATCHER_ID_SCALE, (int)(contained.getSize() * 100)); return this; } - + public IBee getBee() { return contained; } - + public EntityBee setType(EnumBeeType type) { this.type = type; return this; } - + public EnumBeeType getType() { return type; } - + public EntityBee setSpecies(IAlleleBeeSpecies species) { this.species = species; resetAppearance(); lastUpdate = worldObj.getTotalWorldTime(); return this; } - + @SideOnly(Side.CLIENT) private ResourceLocation textureResource; private long lastTextureUpdate; + @SideOnly(Side.CLIENT) public ResourceLocation getTexture() { - if(textureResource == null || lastTextureUpdate != lastUpdate) + if (textureResource == null || lastTextureUpdate != lastUpdate) textureResource = new ForestryResource(beeTexture); - + return textureResource; } - + } diff --git a/src/main/java/forestry/arboriculture/render/FruitPodRenderingHandler.java b/src/main/java/forestry/arboriculture/render/FruitPodRenderingHandler.java index ebc0b4ac5..0c7a34959 100755 --- a/src/main/java/forestry/arboriculture/render/FruitPodRenderingHandler.java +++ b/src/main/java/forestry/arboriculture/render/FruitPodRenderingHandler.java @@ -52,10 +52,10 @@ public class FruitPodRenderingHandler implements ISimpleBlockRenderingHandler { double d1 = 15.0D; double d2 = 4.0D; double d3 = 4.0D + l1; - double d4 = (double)podIcon.getInterpolatedU(d0); - double d5 = (double)podIcon.getInterpolatedU(d1); - double d6 = (double)podIcon.getInterpolatedV(d2); - double d7 = (double)podIcon.getInterpolatedV(d3); + double d4 = (double) podIcon.getInterpolatedU(d0); + double d5 = (double) podIcon.getInterpolatedU(d1); + double d6 = (double) podIcon.getInterpolatedV(d2); + double d7 = (double) podIcon.getInterpolatedV(d3); double d8 = 0.0D; double d9 = 0.0D; @@ -104,10 +104,10 @@ public class FruitPodRenderingHandler implements ISimpleBlockRenderingHandler { if (maturity >= 2) i2 = k1 - 1; - d4 = (double)podIcon.getMinU(); - d5 = (double)podIcon.getInterpolatedU((double)i2); - d6 = (double)podIcon.getMinV(); - d7 = (double)podIcon.getInterpolatedV((double)i2); + d4 = (double) podIcon.getMinU(); + d5 = (double) podIcon.getInterpolatedU((double) i2); + d6 = (double) podIcon.getMinV(); + d7 = (double) podIcon.getInterpolatedV((double) i2); tessellator.addVertexWithUV(d10, d13, d15, d4, d7); tessellator.addVertexWithUV(d11, d13, d15, d5, d7); @@ -117,10 +117,10 @@ public class FruitPodRenderingHandler implements ISimpleBlockRenderingHandler { tessellator.addVertexWithUV(d11, d12, d14, d5, d6); tessellator.addVertexWithUV(d11, d12, d15, d5, d7); tessellator.addVertexWithUV(d10, d12, d15, d4, d7); - d4 = (double)podIcon.getInterpolatedU(12.0D); - d5 = (double)podIcon.getMaxU(); - d6 = (double)podIcon.getMinV(); - d7 = (double)podIcon.getInterpolatedV(4.0D); + d4 = (double) podIcon.getInterpolatedU(12.0D); + d5 = (double) podIcon.getMaxU(); + d6 = (double) podIcon.getMinV(); + d7 = (double) podIcon.getInterpolatedV(4.0D); d8 = 8.0D; d9 = 0.0D; double d16; diff --git a/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java b/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java index 756b95e45..b65e70a9b 100755 --- a/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java +++ b/src/main/java/forestry/arboriculture/render/SaplingRenderHandler.java @@ -90,10 +90,10 @@ public class SaplingRenderHandler implements ISimpleBlockRenderingHandler { Tessellator tess = Tessellator.instance; IIcon icon = species.getGermlingIcon(EnumGermlingType.SAPLING, renderLayer); - double d3 = (double)icon.getMinU(); - double d4 = (double)icon.getMinV(); - double d5 = (double)icon.getMaxU(); - double d6 = (double)icon.getMaxV(); + double d3 = (double) icon.getMinU(); + double d4 = (double) icon.getMinV(); + double d5 = (double) icon.getMaxU(); + double d6 = (double) icon.getMaxV(); double d7 = 0.45D * mod; double d8 = par3 + 0.5D - d7; double d9 = par3 + 0.5D + d7; diff --git a/src/main/java/forestry/core/fluids/tanks/FakeTank.java b/src/main/java/forestry/core/fluids/tanks/FakeTank.java index 34086cc1e..96e12f65c 100644 --- a/src/main/java/forestry/core/fluids/tanks/FakeTank.java +++ b/src/main/java/forestry/core/fluids/tanks/FakeTank.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -14,27 +14,26 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; /** - * * @author CovertJaguar */ public final class FakeTank extends StandardTank { - public static final FakeTank INSTANCE = new FakeTank(); - public static final FakeTank[] ARRAY = new FakeTank[]{INSTANCE}; - public static final FluidTankInfo[] INFO = new FluidTankInfo[]{INSTANCE.getInfo()}; + public static final FakeTank INSTANCE = new FakeTank(); + public static final FakeTank[] ARRAY = new FakeTank[]{INSTANCE}; + public static final FluidTankInfo[] INFO = new FluidTankInfo[]{INSTANCE.getInfo()}; - private FakeTank() { - super(1); - } + private FakeTank() { + super(1); + } - @Override - public int fill(FluidStack resource, boolean doFill) { - return 0; - } + @Override + public int fill(FluidStack resource, boolean doFill) { + return 0; + } - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - return null; - } + @Override + public FluidStack drain(int maxDrain, boolean doDrain) { + return null; + } } diff --git a/src/main/java/forestry/core/gadgets/BlockStainedGlass.java b/src/main/java/forestry/core/gadgets/BlockStainedGlass.java index 7bafb1a5a..e22b3e646 100755 --- a/src/main/java/forestry/core/gadgets/BlockStainedGlass.java +++ b/src/main/java/forestry/core/gadgets/BlockStainedGlass.java @@ -72,8 +72,8 @@ public class BlockStainedGlass extends BlockBreakable { @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta) { - Block block = world.getBlock(x, y, z); - return block == this ? false : super.shouldSideBeRendered(world, x, y, z, meta); + Block block = world.getBlock(x, y, z); + return block == this ? false : super.shouldSideBeRendered(world, x, y, z, meta); } @Override diff --git a/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java b/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java index c6d03e626..55be211ec 100755 --- a/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java +++ b/src/main/java/forestry/core/gui/buttons/ButtonTextureSet.java @@ -4,45 +4,44 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package forestry.core.gui.buttons; /** - * * @author CovertJaguar */ public class ButtonTextureSet implements IButtonTextureSet { - private final int x, y, height, width; + private final int x, y, height, width; - public ButtonTextureSet(int x, int y, int height, int width) { - this.x = x; - this.y = y; - this.height = height; - this.width = width; - } + public ButtonTextureSet(int x, int y, int height, int width) { + this.x = x; + this.y = y; + this.height = height; + this.width = width; + } - @Override - public int getX() { - return x; - } + @Override + public int getX() { + return x; + } - @Override - public int getY() { - return y; - } + @Override + public int getY() { + return y; + } - @Override - public int getHeight() { - return height; - } + @Override + public int getHeight() { + return height; + } - @Override - public int getWidth() { - return width; - } + @Override + public int getWidth() { + return width; + } } diff --git a/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java b/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java index 3176d5b87..20f29db52 100755 --- a/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java +++ b/src/main/java/forestry/core/gui/buttons/GuiButtonSmall.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -16,12 +16,12 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiButtonSmall extends GuiBetterButton { - public GuiButtonSmall(int i, int x, int y, String s) { - this(i, x, y, 200, s); - } + public GuiButtonSmall(int i, int x, int y, String s) { + this(i, x, y, 200, s); + } - public GuiButtonSmall(int i, int x, int y, int w, String s) { - super(i, x, y, w, StandardButtonTextureSets.SMALL_BUTTON, s); - } + public GuiButtonSmall(int i, int x, int y, int w, String s) { + super(i, x, y, w, StandardButtonTextureSets.SMALL_BUTTON, s); + } } diff --git a/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java b/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java index 37c138b53..14db67a00 100755 --- a/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java +++ b/src/main/java/forestry/core/gui/buttons/GuiToggleButtonSmall.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -16,13 +16,13 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiToggleButtonSmall extends GuiToggleButton { - public GuiToggleButtonSmall(int i, int j, int k, String s, boolean active) { - this(i, j, k, 200, s, active); - } + public GuiToggleButtonSmall(int i, int j, int k, String s, boolean active) { + this(i, j, k, 200, s, active); + } - public GuiToggleButtonSmall(int i, int x, int y, int w, String s, boolean active) { - super(i, x, y, w, StandardButtonTextureSets.SMALL_BUTTON, s, active); - this.active = active; - } + public GuiToggleButtonSmall(int i, int x, int y, int w, String s, boolean active) { + super(i, x, y, w, StandardButtonTextureSets.SMALL_BUTTON, s, active); + this.active = active; + } } diff --git a/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java b/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java index ccd042678..6128bcb7a 100755 --- a/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java +++ b/src/main/java/forestry/core/gui/buttons/IButtonTextureSet.java @@ -4,24 +4,23 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package forestry.core.gui.buttons; /** - * * @author CovertJaguar */ public interface IButtonTextureSet { - public int getX(); + public int getX(); - public int getY(); + public int getY(); - public int getHeight(); + public int getHeight(); - public int getWidth(); + public int getWidth(); } diff --git a/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java b/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java index 6b0621221..952b5999b 100755 --- a/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java +++ b/src/main/java/forestry/core/gui/buttons/IMultiButtonState.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -14,17 +14,16 @@ import forestry.core.gui.tooltips.ToolTip; /** - * * @author CovertJaguar */ public interface IMultiButtonState { - public String getLabel(); + public String getLabel(); - public String name(); + public String name(); - public IButtonTextureSet getTextureSet(); + public IButtonTextureSet getTextureSet(); - public ToolTip getToolTip(); + public ToolTip getToolTip(); } diff --git a/src/main/java/forestry/core/gui/buttons/LockButtonState.java b/src/main/java/forestry/core/gui/buttons/LockButtonState.java index c9c7f57f1..bb994af87 100755 --- a/src/main/java/forestry/core/gui/buttons/LockButtonState.java +++ b/src/main/java/forestry/core/gui/buttons/LockButtonState.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -13,33 +13,32 @@ package forestry.core.gui.buttons; import forestry.core.gui.tooltips.ToolTip; /** - * * @author CovertJaguar */ public enum LockButtonState implements IMultiButtonState { - UNLOCKED(new ButtonTextureSet(224, 0, 16, 16)), - LOCKED(new ButtonTextureSet(240, 0, 16, 16)); - public static final LockButtonState[] VALUES = values(); - private final IButtonTextureSet texture; + UNLOCKED(new ButtonTextureSet(224, 0, 16, 16)), + LOCKED(new ButtonTextureSet(240, 0, 16, 16)); + public static final LockButtonState[] VALUES = values(); + private final IButtonTextureSet texture; - private LockButtonState(IButtonTextureSet texture) { - this.texture = texture; - } + private LockButtonState(IButtonTextureSet texture) { + this.texture = texture; + } - @Override - public String getLabel() { - return ""; - } + @Override + public String getLabel() { + return ""; + } - @Override - public IButtonTextureSet getTextureSet() { - return texture; - } + @Override + public IButtonTextureSet getTextureSet() { + return texture; + } - @Override - public ToolTip getToolTip() { - return null; - } + @Override + public ToolTip getToolTip() { + return null; + } } diff --git a/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java b/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java index 54a730ad0..8ce3e7a6e 100755 --- a/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java +++ b/src/main/java/forestry/core/gui/buttons/StandardButtonTextureSets.java @@ -4,53 +4,52 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package forestry.core.gui.buttons; /** - * * @author CovertJaguar */ -public enum StandardButtonTextureSets implements IButtonTextureSet{ +public enum StandardButtonTextureSets implements IButtonTextureSet { LARGE_BUTTON(0, 0, 20, 200), SMALL_BUTTON(0, 80, 15, 200), - LOCKED_BUTTON(224, 0, 16, 16), - UNLOCKED_BUTTON(240, 0, 16, 16), - LEFT_BUTTON(204, 0, 16, 10), - RIGHT_BUTTON(214, 0, 16, 10), - LEFT_BUTTON_SMALL(238, 220, 12, 9), - RIGHT_BUTTON_SMALL(247, 220, 12, 9); - private final int x, y, height, width; + LOCKED_BUTTON(224, 0, 16, 16), + UNLOCKED_BUTTON(240, 0, 16, 16), + LEFT_BUTTON(204, 0, 16, 10), + RIGHT_BUTTON(214, 0, 16, 10), + LEFT_BUTTON_SMALL(238, 220, 12, 9), + RIGHT_BUTTON_SMALL(247, 220, 12, 9); + private final int x, y, height, width; - private StandardButtonTextureSets(int x, int y, int height, int width) { - this.x = x; - this.y = y; - this.height = height; - this.width = width; - } + private StandardButtonTextureSets(int x, int y, int height, int width) { + this.x = x; + this.y = y; + this.height = height; + this.width = width; + } - @Override - public int getX() { - return x; - } + @Override + public int getX() { + return x; + } - @Override - public int getY() { - return y; - } + @Override + public int getY() { + return y; + } - @Override - public int getHeight() { - return height; - } + @Override + public int getHeight() { + return height; + } - @Override - public int getWidth() { - return width; - } + @Override + public int getWidth() { + return width; + } } diff --git a/src/main/java/forestry/core/gui/slots/SlotCrafter.java b/src/main/java/forestry/core/gui/slots/SlotCrafter.java index a964c5f61..c5bd06007 100755 --- a/src/main/java/forestry/core/gui/slots/SlotCrafter.java +++ b/src/main/java/forestry/core/gui/slots/SlotCrafter.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -40,9 +40,9 @@ public class SlotCrafter extends Slot { } @Override - public boolean canTakeStack(EntityPlayer player) { - return crafter.canTakeStack(getSlotIndex()); - } + public boolean canTakeStack(EntityPlayer player) { + return crafter.canTakeStack(getSlotIndex()); + } @Override public ItemStack getStack() { diff --git a/src/main/java/forestry/core/gui/slots/SlotItemInventory.java b/src/main/java/forestry/core/gui/slots/SlotItemInventory.java index 61d17f7f1..a5e3a055e 100755 --- a/src/main/java/forestry/core/gui/slots/SlotItemInventory.java +++ b/src/main/java/forestry/core/gui/slots/SlotItemInventory.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -21,7 +21,7 @@ public class SlotItemInventory extends Slot { private final EntityPlayer player; private ContainerItemInventory container; - + public SlotItemInventory(ContainerItemInventory container, IInventory inventory, EntityPlayer player, int par2, int par3, int par4) { super(inventory, par2, par3, par4); this.container = container; @@ -29,9 +29,9 @@ public class SlotItemInventory extends Slot { } @Override - public void onSlotChange(ItemStack par1ItemStack, ItemStack par2ItemStack) { - super.onSlotChange(par1ItemStack, par2ItemStack); - container.saveInventory(player); - } + public void onSlotChange(ItemStack par1ItemStack, ItemStack par2ItemStack) { + super.onSlotChange(par1ItemStack, par2ItemStack); + container.saveInventory(player); + } } diff --git a/src/main/java/forestry/core/gui/tooltips/ToolTip.java b/src/main/java/forestry/core/gui/tooltips/ToolTip.java index aeb08c6c6..a29384c37 100755 --- a/src/main/java/forestry/core/gui/tooltips/ToolTip.java +++ b/src/main/java/forestry/core/gui/tooltips/ToolTip.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -18,62 +18,61 @@ import com.google.common.collect.ForwardingList; import forestry.core.utils.StringUtil; /** - * * @author CovertJaguar */ public class ToolTip extends ForwardingList { - private final List delegate = new ArrayList(); - private final long delay; - private long mouseOverStart; + private final List delegate = new ArrayList(); + private final long delay; + private long mouseOverStart; - public ToolTip() { - this.delay = 0; - } + public ToolTip() { + this.delay = 0; + } - public ToolTip(int delay) { - this.delay = delay; - } + public ToolTip(int delay) { + this.delay = delay; + } - @Override - protected final List delegate() { - return delegate; - } + @Override + protected final List delegate() { + return delegate; + } - public boolean add(String line) { - return add(new ToolTipLine(line)); - } + public boolean add(String line) { + return add(new ToolTipLine(line)); + } - public void onTick(boolean mouseOver) { - if (delay == 0) - return; - if (mouseOver) { - if (mouseOverStart == 0) - mouseOverStart = System.currentTimeMillis(); - } else - mouseOverStart = 0; - } + public void onTick(boolean mouseOver) { + if (delay == 0) + return; + if (mouseOver) { + if (mouseOverStart == 0) + mouseOverStart = System.currentTimeMillis(); + } else + mouseOverStart = 0; + } - public boolean isReady() { - if (delay == 0) - return true; - if (mouseOverStart == 0) - return false; - return System.currentTimeMillis() - mouseOverStart >= delay; - } + public boolean isReady() { + if (delay == 0) + return true; + if (mouseOverStart == 0) + return false; + return System.currentTimeMillis() - mouseOverStart >= delay; + } - public void refresh() { - } + public void refresh() { + } - public List convertToStrings() { - List tips = new ArrayList(size()); - for (ToolTipLine line : this) { - tips.add(line.text); - } - return tips; - } + public List convertToStrings() { + List tips = new ArrayList(size()); + for (ToolTipLine line : this) { + tips.add(line.text); + } + return tips; + } - public static ToolTip buildToolTip(String tipTag, String... vars) { + public static ToolTip buildToolTip(String tipTag, String... vars) { ToolTip toolTip = new ToolTip(750); String text = StringUtil.localize(tipTag); for (String var : vars) { @@ -86,6 +85,6 @@ public class ToolTip extends ForwardingList { toolTip.add(new ToolTipLine(tip)); } return toolTip; - } + } } diff --git a/src/main/java/forestry/core/inventory/ITileFilter.java b/src/main/java/forestry/core/inventory/ITileFilter.java index 7ad296af8..d12f3e646 100755 --- a/src/main/java/forestry/core/inventory/ITileFilter.java +++ b/src/main/java/forestry/core/inventory/ITileFilter.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -13,11 +13,10 @@ package forestry.core.inventory; import net.minecraft.tileentity.TileEntity; /** - * * @author CovertJaguar */ public interface ITileFilter { - public boolean matches(TileEntity tile); + public boolean matches(TileEntity tile); } diff --git a/src/main/java/forestry/core/inventory/InventorySorter.java b/src/main/java/forestry/core/inventory/InventorySorter.java index eebad12e8..78f30bf3e 100755 --- a/src/main/java/forestry/core/inventory/InventorySorter.java +++ b/src/main/java/forestry/core/inventory/InventorySorter.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -15,16 +15,15 @@ import java.util.Comparator; import net.minecraft.inventory.IInventory; /** - * * @author CovertJaguar */ public enum InventorySorter implements Comparator { - SIZE_DECENDING { - @Override - public int compare(IInventory inv1, IInventory inv2) { - return inv2.getSizeInventory() - inv1.getSizeInventory(); - } + SIZE_DECENDING { + @Override + public int compare(IInventory inv1, IInventory inv2) { + return inv2.getSizeInventory() - inv1.getSizeInventory(); + } - }; + }; } diff --git a/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java b/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java index 6a6693950..71a8b7472 100755 --- a/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java +++ b/src/main/java/forestry/core/inventory/ItemStackSizeSorter.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -18,22 +18,22 @@ import net.minecraft.item.ItemStack; public class ItemStackSizeSorter implements Comparator { - private static ItemStackSizeSorter instance; + private static ItemStackSizeSorter instance; - private static ItemStackSizeSorter getInstance() { - if (instance == null) { - instance = new ItemStackSizeSorter(); - } - return instance; - } + private static ItemStackSizeSorter getInstance() { + if (instance == null) { + instance = new ItemStackSizeSorter(); + } + return instance; + } - public static void sort(List list) { - Collections.sort(list, getInstance()); - } + public static void sort(List list) { + Collections.sort(list, getInstance()); + } - @Override - public int compare(ItemStack o1, ItemStack o2) { - return o1.stackSize - o2.stackSize; - } + @Override + public int compare(ItemStack o1, ItemStack o2) { + return o1.stackSize - o2.stackSize; + } } diff --git a/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java b/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java index 95fcce96f..9e9a7fb3a 100755 --- a/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java +++ b/src/main/java/forestry/core/inventory/filters/ArrayStackFilter.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -15,35 +15,34 @@ import net.minecraft.item.ItemStack; import forestry.core.inventory.InvTools; /** - * * @author CovertJaguar */ public class ArrayStackFilter implements IStackFilter { - private final ItemStack[] stacks; + private final ItemStack[] stacks; - public ArrayStackFilter(ItemStack... stacks) { - this.stacks = stacks; - } + public ArrayStackFilter(ItemStack... stacks) { + this.stacks = stacks; + } - @Override - public boolean matches(ItemStack stack) { - if (stacks.length == 0 || !hasFilter()) { - return true; - } - return InvTools.isItemEqual(stack, stacks); - } + @Override + public boolean matches(ItemStack stack) { + if (stacks.length == 0 || !hasFilter()) { + return true; + } + return InvTools.isItemEqual(stack, stacks); + } - public ItemStack[] getStacks() { - return stacks; - } + public ItemStack[] getStacks() { + return stacks; + } - public boolean hasFilter() { - for (ItemStack filter : stacks) { - if (filter != null) { - return true; - } - } - return false; - } + public boolean hasFilter() { + for (ItemStack filter : stacks) { + if (filter != null) { + return true; + } + } + return false; + } } diff --git a/src/main/java/forestry/core/inventory/filters/InvertedStackFilter.java b/src/main/java/forestry/core/inventory/filters/InvertedStackFilter.java index 46bee45e4..fc041f978 100755 --- a/src/main/java/forestry/core/inventory/filters/InvertedStackFilter.java +++ b/src/main/java/forestry/core/inventory/filters/InvertedStackFilter.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -13,22 +13,21 @@ package forestry.core.inventory.filters; import net.minecraft.item.ItemStack; /** - * * @author CovertJaguar */ public class InvertedStackFilter implements IStackFilter { - private final IStackFilter filter; + private final IStackFilter filter; - public InvertedStackFilter(IStackFilter filter) { - this.filter = filter; - } + public InvertedStackFilter(IStackFilter filter) { + this.filter = filter; + } - @Override - public boolean matches(ItemStack stack) { - if (stack == null) { - return false; - } - return !filter.matches(stack); - } + @Override + public boolean matches(ItemStack stack) { + if (stack == null) { + return false; + } + return !filter.matches(stack); + } } diff --git a/src/main/java/forestry/core/inventory/manipulators/InventoryManipulator.java b/src/main/java/forestry/core/inventory/manipulators/InventoryManipulator.java index 1d56df808..8d1a6fcfd 100755 --- a/src/main/java/forestry/core/inventory/manipulators/InventoryManipulator.java +++ b/src/main/java/forestry/core/inventory/manipulators/InventoryManipulator.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -23,7 +23,6 @@ import forestry.core.inventory.wrappers.IInvSlot; import forestry.core.inventory.wrappers.InventoryIterator; /** - * * @author CovertJaguar */ public class InventoryManipulator { @@ -110,14 +109,13 @@ public class InventoryManipulator { } /** - * * @param slot * @param stack * @param available Amount we can move * @param doAdd * @return Return the number of items moved. */ - private int addToSlot(IInvSlot slot, ItemStack stack, int available, boolean doAdd) { + private int addToSlot(IInvSlot slot, ItemStack stack, int available, boolean doAdd) { int max = Math.min(stack.getMaxStackSize(), inv.getInventoryStackLimit()); ItemStack stackInSlot = slot.getStackInSlot(); @@ -149,48 +147,48 @@ public class InventoryManipulator { slot.setStackInSlot(stackInSlot); } return wanted; - } + } - public boolean canRemoveItem(IStackFilter filter) { - return tryRemoveItem(filter) == null; - } + public boolean canRemoveItem(IStackFilter filter) { + return tryRemoveItem(filter) == null; + } - public ItemStack tryRemoveItem(IStackFilter filter) { - for (IInvSlot slot : getSlots()) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null && slot.canTakeStackFromSlot(stack) && filter.matches(stack)) { - ItemStack output = stack.copy(); - output.stackSize = 1; - return output; - } - } - return null; - } + public ItemStack tryRemoveItem(IStackFilter filter) { + for (IInvSlot slot : getSlots()) { + ItemStack stack = slot.getStackInSlot(); + if (stack != null && slot.canTakeStackFromSlot(stack) && filter.matches(stack)) { + ItemStack output = stack.copy(); + output.stackSize = 1; + return output; + } + } + return null; + } - public ItemStack removeItem(IStackFilter filter) { - for (IInvSlot slot : getSlots()) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null && slot.canTakeStackFromSlot(stack) && filter.matches(stack)) { - return slot.decreaseStackInSlot(); - } - } - return null; - } + public ItemStack removeItem(IStackFilter filter) { + for (IInvSlot slot : getSlots()) { + ItemStack stack = slot.getStackInSlot(); + if (stack != null && slot.canTakeStackFromSlot(stack) && filter.matches(stack)) { + return slot.decreaseStackInSlot(); + } + } + return null; + } - public ItemStack moveItem(IInventory dest, IStackFilter filter) { - InventoryManipulator imDest = InventoryManipulator.get(dest); - for (IInvSlot slot : getSlots()) { - ItemStack stack = slot.getStackInSlot(); - if (stack != null && slot.canTakeStackFromSlot(stack) && filter.matches(stack)) { - stack = stack.copy(); - stack.stackSize = 1; - stack = imDest.addStack(stack); - if (stack == null) { - return slot.decreaseStackInSlot(); - } - } - } - return null; - } + public ItemStack moveItem(IInventory dest, IStackFilter filter) { + InventoryManipulator imDest = InventoryManipulator.get(dest); + for (IInvSlot slot : getSlots()) { + ItemStack stack = slot.getStackInSlot(); + if (stack != null && slot.canTakeStackFromSlot(stack) && filter.matches(stack)) { + stack = stack.copy(); + stack.stackSize = 1; + stack = imDest.addStack(stack); + if (stack == null) { + return slot.decreaseStackInSlot(); + } + } + } + return null; + } } diff --git a/src/main/java/forestry/core/inventory/wrappers/IInvSlot.java b/src/main/java/forestry/core/inventory/wrappers/IInvSlot.java index 39246a4f5..895c67b35 100755 --- a/src/main/java/forestry/core/inventory/wrappers/IInvSlot.java +++ b/src/main/java/forestry/core/inventory/wrappers/IInvSlot.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -13,21 +13,20 @@ package forestry.core.inventory.wrappers; import net.minecraft.item.ItemStack; /** - * * @author CovertJaguar */ public interface IInvSlot { - boolean canPutStackInSlot(ItemStack stack); + boolean canPutStackInSlot(ItemStack stack); - boolean canTakeStackFromSlot(ItemStack stack); + boolean canTakeStackFromSlot(ItemStack stack); - ItemStack decreaseStackInSlot(); + ItemStack decreaseStackInSlot(); - ItemStack getStackInSlot(); + ItemStack getStackInSlot(); + + void setStackInSlot(ItemStack stack); + + int getIndex(); - void setStackInSlot(ItemStack stack); - - int getIndex(); - } diff --git a/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java b/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java index ecbb4fbd6..2837ee3e3 100755 --- a/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java +++ b/src/main/java/forestry/core/inventory/wrappers/InventoryIterator.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -21,80 +21,80 @@ import net.minecraft.item.ItemStack; */ public class InventoryIterator implements Iterable { - public static Iterable getIterable(IInventory inv) { - if (inv instanceof ISidedInventory) - return new SidedInventoryIterator((ISidedInventory) inv); - return new InventoryIterator(inv); - } + public static Iterable getIterable(IInventory inv) { + if (inv instanceof ISidedInventory) + return new SidedInventoryIterator((ISidedInventory) inv); + return new InventoryIterator(inv); + } - private final IInventory inv; - private final int invSize; + private final IInventory inv; + private final int invSize; - private InventoryIterator(IInventory inv) { - this.inv = inv; - this.invSize = inv.getSizeInventory(); - } + private InventoryIterator(IInventory inv) { + this.inv = inv; + this.invSize = inv.getSizeInventory(); + } - @Override - public Iterator iterator() { - return new Iterator() { - int slot = 0; + @Override + public Iterator iterator() { + return new Iterator() { + int slot = 0; - @Override - public boolean hasNext() { - return slot < invSize; - } + @Override + public boolean hasNext() { + return slot < invSize; + } - @Override - public IInvSlot next() { - return new InvSlot(slot++); - } + @Override + public IInvSlot next() { + return new InvSlot(slot++); + } - @Override - public void remove() { - throw new UnsupportedOperationException("Remove not supported."); - } + @Override + public void remove() { + throw new UnsupportedOperationException("Remove not supported."); + } - }; - } + }; + } - private class InvSlot implements IInvSlot { + private class InvSlot implements IInvSlot { - private int slot; + private int slot; - public InvSlot(int slot) { - this.slot = slot; - } + public InvSlot(int slot) { + this.slot = slot; + } - @Override - public ItemStack getStackInSlot() { - return inv.getStackInSlot(slot); - } + @Override + public ItemStack getStackInSlot() { + return inv.getStackInSlot(slot); + } - @Override - public void setStackInSlot(ItemStack stack) { - inv.setInventorySlotContents(slot, stack); - } + @Override + public void setStackInSlot(ItemStack stack) { + inv.setInventorySlotContents(slot, stack); + } - @Override - public boolean canPutStackInSlot(ItemStack stack) { - return inv.isItemValidForSlot(slot, stack); - } + @Override + public boolean canPutStackInSlot(ItemStack stack) { + return inv.isItemValidForSlot(slot, stack); + } - @Override - public boolean canTakeStackFromSlot(ItemStack stack) { - return true; - } + @Override + public boolean canTakeStackFromSlot(ItemStack stack) { + return true; + } - @Override - public ItemStack decreaseStackInSlot() { - return inv.decrStackSize(slot, 1); - } + @Override + public ItemStack decreaseStackInSlot() { + return inv.decrStackSize(slot, 1); + } - @Override - public int getIndex() { - return slot; - } + @Override + public int getIndex() { + return slot; + } - } + } } diff --git a/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java b/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java index 9c18e0686..88532074b 100755 --- a/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java +++ b/src/main/java/forestry/core/inventory/wrappers/SidedInventoryIterator.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -20,73 +20,73 @@ import net.minecraft.item.ItemStack; */ public class SidedInventoryIterator implements Iterable { - private final ISidedInventory inv; + private final ISidedInventory inv; - SidedInventoryIterator(ISidedInventory inv) { - this.inv = inv; - } + SidedInventoryIterator(ISidedInventory inv) { + this.inv = inv; + } - @Override - public Iterator iterator() { - return new Iterator() { - int[] slots = inv.getAccessibleSlotsFromSide(0); - int index = 0; + @Override + public Iterator iterator() { + return new Iterator() { + int[] slots = inv.getAccessibleSlotsFromSide(0); + int index = 0; - @Override - public boolean hasNext() { - return slots != null && index < slots.length; - } + @Override + public boolean hasNext() { + return slots != null && index < slots.length; + } - @Override - public IInvSlot next() { - return new InvSlot(slots[index++]); - } + @Override + public IInvSlot next() { + return new InvSlot(slots[index++]); + } - @Override - public void remove() { - throw new UnsupportedOperationException("Remove not supported."); - } + @Override + public void remove() { + throw new UnsupportedOperationException("Remove not supported."); + } - }; - } + }; + } - private class InvSlot implements IInvSlot { + private class InvSlot implements IInvSlot { - private int slot; + private int slot; - public InvSlot(int slot) { - this.slot = slot; - } + public InvSlot(int slot) { + this.slot = slot; + } - @Override - public ItemStack getStackInSlot() { - return inv.getStackInSlot(slot); - } + @Override + public ItemStack getStackInSlot() { + return inv.getStackInSlot(slot); + } - @Override - public void setStackInSlot(ItemStack stack) { - inv.setInventorySlotContents(slot, stack); - } + @Override + public void setStackInSlot(ItemStack stack) { + inv.setInventorySlotContents(slot, stack); + } - @Override - public boolean canPutStackInSlot(ItemStack stack) { - return inv.canInsertItem(slot, stack, 0); - } + @Override + public boolean canPutStackInSlot(ItemStack stack) { + return inv.canInsertItem(slot, stack, 0); + } - @Override - public boolean canTakeStackFromSlot(ItemStack stack) { - return inv.canExtractItem(slot, stack, 0); - } + @Override + public boolean canTakeStackFromSlot(ItemStack stack) { + return inv.canExtractItem(slot, stack, 0); + } - @Override - public ItemStack decreaseStackInSlot() { - return inv.decrStackSize(slot, 1); - } - - @Override - public int getIndex(){ - return slot; - } + @Override + public ItemStack decreaseStackInSlot() { + return inv.decrStackSize(slot, 1); + } - } + @Override + public int getIndex() { + return slot; + } + + } } diff --git a/src/main/java/forestry/core/triggers/Trigger.java b/src/main/java/forestry/core/triggers/Trigger.java index 5763cfa64..3e04f7cd1 100755 --- a/src/main/java/forestry/core/triggers/Trigger.java +++ b/src/main/java/forestry/core/triggers/Trigger.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -63,6 +63,7 @@ public abstract class Trigger implements ITileTrigger { public ITriggerParameter createParameter() { return null; } + @SideOnly(Side.CLIENT) private IIcon icon; @@ -78,8 +79,8 @@ public abstract class Trigger implements ITileTrigger { icon = TextureManager.getInstance().registerTex(register, "triggers/" + unlocalized.replace("trigger.", "")); } - @Override - public ITrigger rotateLeft() { - return this; - } + @Override + public ITrigger rotateLeft() { + return this; + } } diff --git a/src/main/java/forestry/core/utils/Fluids.java b/src/main/java/forestry/core/utils/Fluids.java index 5a0f16838..681b8632f 100755 --- a/src/main/java/forestry/core/utils/Fluids.java +++ b/src/main/java/forestry/core/utils/Fluids.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -19,40 +19,39 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; /** - * * @author CovertJaguar */ public enum Fluids { - WATER, LAVA, FUEL, BIOFUEL, CREOSOTE, STEAM; + WATER, LAVA, FUEL, BIOFUEL, CREOSOTE, STEAM; - public String getTag() { - return name().toLowerCase(Locale.ENGLISH); - } + public String getTag() { + return name().toLowerCase(Locale.ENGLISH); + } - public Fluid get() { - return FluidRegistry.getFluid(getTag()); - } + public Fluid get() { + return FluidRegistry.getFluid(getTag()); + } - public FluidStack get(int qty) { - return FluidRegistry.getFluidStack(getTag(), qty); - } + public FluidStack get(int qty) { + return FluidRegistry.getFluidStack(getTag(), qty); + } - public boolean is(Fluid fluid) { - return get() == fluid; - } + public boolean is(Fluid fluid) { + return get() == fluid; + } - public boolean is(FluidStack fluidStack) { - return fluidStack != null && get() == fluidStack.getFluid(); - } + public boolean is(FluidStack fluidStack) { + return fluidStack != null && get() == fluidStack.getFluid(); + } - public boolean isContained(ItemStack containerStack) { - return containerStack != null && LiquidHelper.containsFluid(containerStack, Fluids.WATER.get()); - } + public boolean isContained(ItemStack containerStack) { + return containerStack != null && LiquidHelper.containsFluid(containerStack, Fluids.WATER.get()); + } - public static boolean areEqual(Fluid fluid, FluidStack fluidStack){ - if(fluidStack != null && fluid == fluidStack.getFluid()) - return true; - return fluid == null && fluidStack == null; - } + public static boolean areEqual(Fluid fluid, FluidStack fluidStack) { + if (fluidStack != null && fluid == fluidStack.getFluid()) + return true; + return fluid == null && fluidStack == null; + } } diff --git a/src/main/java/forestry/core/utils/NBTUtil.java b/src/main/java/forestry/core/utils/NBTUtil.java index 03ee22182..59cd1c1fc 100644 --- a/src/main/java/forestry/core/utils/NBTUtil.java +++ b/src/main/java/forestry/core/utils/NBTUtil.java @@ -4,7 +4,7 @@ * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl-3.0.txt - * + * * Various Contributors including, but not limited to: * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ @@ -12,66 +12,67 @@ package forestry.core.utils; import com.google.common.collect.ForwardingList; import cpw.mods.fml.common.ObfuscationReflectionHelper; + import java.util.ArrayList; import java.util.List; + import net.minecraft.nbt.*; /** - * * @author CovertJaguar */ public class NBTUtil { - public enum EnumNBTType { + public enum EnumNBTType { - END(NBTTagEnd.class), - BYTE(NBTTagByte.class), - SHORT(NBTTagShort.class), - INT(NBTTagInt.class), - LONG(NBTTagLong.class), - FLOAT(NBTTagFloat.class), - DOUBLE(NBTTagDouble.class), - BYTE_ARRAY(NBTTagByteArray.class), - STRING(NBTTagString.class), - LIST(NBTTagList.class), - COMPOUND(NBTTagCompound.class), - INT_ARRAY(NBTTagIntArray.class); - public static final EnumNBTType[] VALUES = values(); - public final Class classObject; + END(NBTTagEnd.class), + BYTE(NBTTagByte.class), + SHORT(NBTTagShort.class), + INT(NBTTagInt.class), + LONG(NBTTagLong.class), + FLOAT(NBTTagFloat.class), + DOUBLE(NBTTagDouble.class), + BYTE_ARRAY(NBTTagByteArray.class), + STRING(NBTTagString.class), + LIST(NBTTagList.class), + COMPOUND(NBTTagCompound.class), + INT_ARRAY(NBTTagIntArray.class); + public static final EnumNBTType[] VALUES = values(); + public final Class classObject; - private EnumNBTType(Class c) { - this.classObject = c; - } + private EnumNBTType(Class c) { + this.classObject = c; + } - public static EnumNBTType fromClass(Class c) { - for (EnumNBTType type : VALUES) { - if (type.classObject == c) - return type; - } - return null; - } + public static EnumNBTType fromClass(Class c) { + for (EnumNBTType type : VALUES) { + if (type.classObject == c) + return type; + } + return null; + } - } + } - public static NBTList getNBTList(NBTTagCompound nbt, String tag, EnumNBTType type) { - NBTTagList nbtList = nbt.getTagList(tag, type.ordinal()); - return new NBTList(nbtList); - } + public static NBTList getNBTList(NBTTagCompound nbt, String tag, EnumNBTType type) { + NBTTagList nbtList = nbt.getTagList(tag, type.ordinal()); + return new NBTList(nbtList); + } - public static class NBTList extends ForwardingList { + public static class NBTList extends ForwardingList { - private final ArrayList backingList; - private final NBTTagList nbtList; + private final ArrayList backingList; + private final NBTTagList nbtList; - public NBTList(NBTTagList nbtList) { - this.nbtList = nbtList; - backingList = ObfuscationReflectionHelper.getPrivateValue(NBTTagList.class, nbtList, 0); - } + public NBTList(NBTTagList nbtList) { + this.nbtList = nbtList; + backingList = ObfuscationReflectionHelper.getPrivateValue(NBTTagList.class, nbtList, 0); + } - @Override - protected List delegate() { - return backingList; - } + @Override + protected List delegate() { + return backingList; + } - } + } } diff --git a/src/main/java/forestry/pipes/PipeItemsPropolis.java b/src/main/java/forestry/pipes/PipeItemsPropolis.java index f54985991..b223e3b94 100755 --- a/src/main/java/forestry/pipes/PipeItemsPropolis.java +++ b/src/main/java/forestry/pipes/PipeItemsPropolis.java @@ -1,8 +1,8 @@ /******************************************************************************* * Copyright 2011-2014 by SirSengir - * + * * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. - * + * * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/. ******************************************************************************/ package forestry.pipes; @@ -51,6 +51,7 @@ public class PipeItemsPropolis extends Pipe { super.writeToNBT(nbt); pipeLogic.writeToNBT(nbt); } + IIconProvider provider; @SideOnly(Side.CLIENT) @@ -84,73 +85,73 @@ public class PipeItemsPropolis extends Pipe { return true; } - public void eventHandler(PipeEventItem.FindDest event) { - LinkedList filteredOrientations = new LinkedList(); - LinkedList typedOrientations = new LinkedList(); - LinkedList defaultOrientations = new LinkedList(); + public void eventHandler(PipeEventItem.FindDest event) { + LinkedList filteredOrientations = new LinkedList(); + LinkedList typedOrientations = new LinkedList(); + LinkedList defaultOrientations = new LinkedList(); - // We need a bee! - EnumFilterType type = EnumFilterType.getType(event.item.getItemStack()); - IBee bee = null; + // We need a bee! + EnumFilterType type = EnumFilterType.getType(event.item.getItemStack()); + IBee bee = null; - if (type != EnumFilterType.ITEM) - bee = PluginApiculture.beeInterface.getMember(event.item.getItemStack()); + if (type != EnumFilterType.ITEM) + bee = PluginApiculture.beeInterface.getMember(event.item.getItemStack()); - // Filtered outputs - for (ForgeDirection dir : event.destinations) { + // Filtered outputs + for (ForgeDirection dir : event.destinations) { - // Continue if this direction is closed. - if (pipeLogic.isClosed(dir)) - continue; + // Continue if this direction is closed. + if (pipeLogic.isClosed(dir)) + continue; - if (pipeLogic.isIndiscriminate(dir)) { - defaultOrientations.add(dir); - continue; - } + if (pipeLogic.isIndiscriminate(dir)) { + defaultOrientations.add(dir); + continue; + } - // We need to match the type for this orientation's filter - if (!pipeLogic.matchType(dir, type, bee)) - continue; + // We need to match the type for this orientation's filter + if (!pipeLogic.matchType(dir, type, bee)) + continue; - // Passing the type filter is enough for non-bee items. - if (type == EnumFilterType.ITEM) { - filteredOrientations.add(dir); - continue; - } + // Passing the type filter is enough for non-bee items. + if (type == EnumFilterType.ITEM) { + filteredOrientations.add(dir); + continue; + } - ArrayList filters = pipeLogic.getGenomeFilters(dir); - // If we have no genome filters, this is only a typed route. - if (filters.size() <= 0) { - typedOrientations.add(dir); - continue; - } + ArrayList filters = pipeLogic.getGenomeFilters(dir); + // If we have no genome filters, this is only a typed route. + if (filters.size() <= 0) { + typedOrientations.add(dir); + continue; + } - // Bees need to match one of the genome filters - for (IAllele[] pattern : filters) { - if (pipeLogic.matchAllele(pattern[0], bee.getIdent()) && pipeLogic.matchAllele(pattern[1], bee.getGenome().getSecondary().getUID())) - filteredOrientations.add(dir); - } - } + // Bees need to match one of the genome filters + for (IAllele[] pattern : filters) { + if (pipeLogic.matchAllele(pattern[0], bee.getIdent()) && pipeLogic.matchAllele(pattern[1], bee.getGenome().getSecondary().getUID())) + filteredOrientations.add(dir); + } + } - event.destinations.clear(); + event.destinations.clear(); - if (filteredOrientations.size() > 0) - event.destinations.addAll(filteredOrientations); - else if (typedOrientations.size() > 0) - event.destinations.addAll(typedOrientations); - else - event.destinations.addAll(defaultOrientations); - } + if (filteredOrientations.size() > 0) + event.destinations.addAll(filteredOrientations); + else if (typedOrientations.size() > 0) + event.destinations.addAll(typedOrientations); + else + event.destinations.addAll(defaultOrientations); + } - public void eventHandler(PipeEventItem.Entered event) { - // A bit of speed to perhaps prevent bees from popping out of the pipe. - try { - event.item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED * 20F); - } catch (Throwable error) { - } - } + public void eventHandler(PipeEventItem.Entered event) { + // A bit of speed to perhaps prevent bees from popping out of the pipe. + try { + event.item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED * 20F); + } catch (Throwable error) { + } + } - public void eventHandler(PipeEventItem.AdjustSpeed event) { - transport.defaultReajustSpeed(event.item); - } + public void eventHandler(PipeEventItem.AdjustSpeed event) { + transport.defaultReajustSpeed(event.item); + } } diff --git a/src/main/java/forestry/pipes/proxy/ProxyPipes.java b/src/main/java/forestry/pipes/proxy/ProxyPipes.java index cf5c7a3b3..1c6f1a424 100755 --- a/src/main/java/forestry/pipes/proxy/ProxyPipes.java +++ b/src/main/java/forestry/pipes/proxy/ProxyPipes.java @@ -1,8 +1,8 @@ /******************************************************************************* * Copyright 2011-2014 by SirSengir - * + * * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License. - * + * * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/. ******************************************************************************/ package forestry.pipes.proxy; @@ -34,36 +34,36 @@ public class ProxyPipes { @SuppressWarnings("rawtypes") public Item createPipe(Class clas, CreativeTabBuildCraft creativeTab) { - return registerPipe(clas, creativeTab); + return registerPipe(clas, creativeTab); } - /** - * Overriding the method in BlockGenericPipe to fix localizations. - */ + /** + * Overriding the method in BlockGenericPipe to fix localizations. + */ @SuppressWarnings("rawtypes") - public static ItemPipe registerPipe(Class clas, CreativeTabBuildCraft creativeTab) { - ItemPipe item = null; - try { - Constructor ctor = ItemPipe.class.getDeclaredConstructor(CreativeTabBuildCraft.class); - ctor.setAccessible(true); - item = ctor.newInstance(creativeTab); - } catch(Exception e) { - e.printStackTrace(); - } - assert item != null : "The ItemPipe instance must not be null"; - item.setUnlocalizedName(clas.getSimpleName()); - GameRegistry.registerItem(item, item.getUnlocalizedName()); + public static ItemPipe registerPipe(Class clas, CreativeTabBuildCraft creativeTab) { + ItemPipe item = null; + try { + Constructor ctor = ItemPipe.class.getDeclaredConstructor(CreativeTabBuildCraft.class); + ctor.setAccessible(true); + item = ctor.newInstance(creativeTab); + } catch (Exception e) { + e.printStackTrace(); + } + assert item != null : "The ItemPipe instance must not be null"; + item.setUnlocalizedName(clas.getSimpleName()); + GameRegistry.registerItem(item, item.getUnlocalizedName()); - BlockGenericPipe.pipes.put(item, clas); + BlockGenericPipe.pipes.put(item, clas); - Pipe dummyPipe = BlockGenericPipe.createPipe(item); - if (dummyPipe != null) { - item.setPipeIconIndex(dummyPipe.getIconIndexForItem()); - TransportProxy.proxy.setIconProviderFromPipe(item, dummyPipe); - } + Pipe dummyPipe = BlockGenericPipe.createPipe(item); + if (dummyPipe != null) { + item.setPipeIconIndex(dummyPipe.getIconIndexForItem()); + TransportProxy.proxy.setIconProviderFromPipe(item, dummyPipe); + } - return item; - } + return item; + } public void registerCraftingPropolis(ItemStack resource) { GameRegistry.addRecipe(new ItemStack(PluginPropolisPipe.pipeItemsPropolis), "#X#", '#', resource, 'X', BuildCraftTransport.pipeItemsDiamond);