automatic spaces to tabs

This commit is contained in:
mezz committed 2014-09-29 16:23:47 -07:00
1 parent 974ce7ea65
commit 83d545e3c7
30 files changed
+596 -607

No files matched your search

@@ -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;
}
}
@@ -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;
@@ -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;
@@ -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 <http://www.railcraft.info>
*/
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;
}
}
@@ -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
@@ -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 <http://www.railcraft.info/>
*/
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;
}
}
@@ -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);
}
}
@@ -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;
}
}
@@ -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 <http://www.railcraft.info/>
*/
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();
}
@@ -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 <http://www.railcraft.info>
*/
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();
}
@@ -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 <http://www.railcraft.info/>
*/
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;
}
}
@@ -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 <http://www.railcraft.info/>
*/
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;
}
}
@@ -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() {
@@ -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);
}
}
@@ -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 <http://www.railcraft.info/>
*/
public class ToolTip extends ForwardingList<ToolTipLine> {
private final List<ToolTipLine> delegate = new ArrayList<ToolTipLine>();
private final long delay;
private long mouseOverStart;
private final List<ToolTipLine> delegate = new ArrayList<ToolTipLine>();
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<ToolTipLine> delegate() {
return delegate;
}
@Override
protected final List<ToolTipLine> 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<String> convertToStrings() {
List<String> tips = new ArrayList<String>(size());
for (ToolTipLine line : this) {
tips.add(line.text);
}
return tips;
}
public List<String> convertToStrings() {
List<String> tips = new ArrayList<String>(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<ToolTipLine> {
toolTip.add(new ToolTipLine(tip));
}
return toolTip;
}
}
}
@@ -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 <http://www.railcraft.info/>
*/
public interface ITileFilter {
public boolean matches(TileEntity tile);
public boolean matches(TileEntity tile);
}
@@ -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 <http://www.railcraft.info/>
*/
public enum InventorySorter implements Comparator<IInventory> {
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();
}
};
};
}
@@ -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<ItemStack> {
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<ItemStack> list) {
Collections.sort(list, getInstance());
}
public static void sort(List<ItemStack> 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;
}
}
@@ -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 <http://www.railcraft.info>
*/
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;
}
}
@@ -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 <http://www.railcraft.info>
*/
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);
}
}
@@ -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 <http://www.railcraft.info>
*/
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;
}
}
@@ -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 <http://www.railcraft.info/>
*/
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();
}
@@ -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<IInvSlot> {
public static Iterable<IInvSlot> getIterable(IInventory inv) {
if (inv instanceof ISidedInventory)
return new SidedInventoryIterator((ISidedInventory) inv);
return new InventoryIterator(inv);
}
public static Iterable<IInvSlot> 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<IInvSlot> iterator() {
return new Iterator<IInvSlot>() {
int slot = 0;
@Override
public Iterator<IInvSlot> iterator() {
return new Iterator<IInvSlot>() {
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;
}
}
}
}
@@ -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<IInvSlot> {
private final ISidedInventory inv;
private final ISidedInventory inv;
SidedInventoryIterator(ISidedInventory inv) {
this.inv = inv;
}
SidedInventoryIterator(ISidedInventory inv) {
this.inv = inv;
}
@Override
public Iterator<IInvSlot> iterator() {
return new Iterator<IInvSlot>() {
int[] slots = inv.getAccessibleSlotsFromSide(0);
int index = 0;
@Override
public Iterator<IInvSlot> iterator() {
return new Iterator<IInvSlot>() {
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;
}
}
}
@@ -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;
}
}
+25 -26
View File
@@ -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 <http://www.railcraft.info>
*/
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;
}
}
+45 -44
View File
@@ -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 <http://www.railcraft.info/>
*/
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<? extends NBTBase> 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<? extends NBTBase> classObject;
private EnumNBTType(Class<? extends NBTBase> c) {
this.classObject = c;
}
private EnumNBTType(Class<? extends NBTBase> c) {
this.classObject = c;
}
public static EnumNBTType fromClass(Class<? extends NBTBase> c) {
for (EnumNBTType type : VALUES) {
if (type.classObject == c)
return type;
}
return null;
}
public static EnumNBTType fromClass(Class<? extends NBTBase> c) {
for (EnumNBTType type : VALUES) {
if (type.classObject == c)
return type;
}
return null;
}
}
}
public static <T extends NBTBase> NBTList<T> getNBTList(NBTTagCompound nbt, String tag, EnumNBTType type) {
NBTTagList nbtList = nbt.getTagList(tag, type.ordinal());
return new NBTList<T>(nbtList);
}
public static <T extends NBTBase> NBTList<T> getNBTList(NBTTagCompound nbt, String tag, EnumNBTType type) {
NBTTagList nbtList = nbt.getTagList(tag, type.ordinal());
return new NBTList<T>(nbtList);
}
public static class NBTList<T extends NBTBase> extends ForwardingList<T> {
public static class NBTList<T extends NBTBase> extends ForwardingList<T> {
private final ArrayList<T> backingList;
private final NBTTagList nbtList;
private final ArrayList<T> 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<T> delegate() {
return backingList;
}
@Override
protected List<T> delegate() {
return backingList;
}
}
}
}
@@ -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<PipeTransportItems> {
super.writeToNBT(nbt);
pipeLogic.writeToNBT(nbt);
}
IIconProvider provider;
@SideOnly(Side.CLIENT)
@@ -84,73 +85,73 @@ public class PipeItemsPropolis extends Pipe<PipeTransportItems> {
return true;
}
public void eventHandler(PipeEventItem.FindDest event) {
LinkedList<ForgeDirection> filteredOrientations = new LinkedList<ForgeDirection>();
LinkedList<ForgeDirection> typedOrientations = new LinkedList<ForgeDirection>();
LinkedList<ForgeDirection> defaultOrientations = new LinkedList<ForgeDirection>();
public void eventHandler(PipeEventItem.FindDest event) {
LinkedList<ForgeDirection> filteredOrientations = new LinkedList<ForgeDirection>();
LinkedList<ForgeDirection> typedOrientations = new LinkedList<ForgeDirection>();
LinkedList<ForgeDirection> defaultOrientations = new LinkedList<ForgeDirection>();
// 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<IAllele[]> 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<IAllele[]> 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);
}
}
@@ -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<? extends Pipe> 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<? extends Pipe> clas, CreativeTabBuildCraft creativeTab) {
ItemPipe item = null;
try {
Constructor<ItemPipe> 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<? extends Pipe> clas, CreativeTabBuildCraft creativeTab) {
ItemPipe item = null;
try {
Constructor<ItemPipe> 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);