This commit is contained in:
mezz committed 2015-03-25 00:51:48 -07:00
1 parent ce3d891eaa
commit 9989451c1c
64 files changed
+234 -439

No files matched your search

@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.apiculture.gadgets;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
@@ -726,8 +726,10 @@ public class Bee extends IndividualLiving implements IBee {
IPollinatable realPollinatable = GeneticsUtil.getOrCreatePollinatable(housing.getOwnerName(), world, posBlock.x, posBlock.y, posBlock.z);
realPollinatable.mateWith(pollen);
return true;
if (realPollinatable != null) {
realPollinatable.mateWith(pollen);
return true;
}
}
return false;
@@ -228,7 +228,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
/**
* List of possible mutations on species alleles.
*/
private static ArrayList<IBeeMutation> beeMutations = new ArrayList<IBeeMutation>();
private static final ArrayList<IBeeMutation> beeMutations = new ArrayList<IBeeMutation>();
@Override
public Collection<IBeeMutation> getMutations(boolean shuffle) {
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleArea;
@@ -41,7 +42,10 @@ public class GuiBeealyzer extends GuiAlyzer {
ArrayList<ItemStack> beeList = new ArrayList<ItemStack>();
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
for (ItemStack beeStack : beeList) {
iconStacks.put(BeeGenome.getSpecies(beeStack).getUID(), beeStack);
IAlleleBeeSpecies species = BeeGenome.getSpecies(beeStack);
if (species != null) {
iconStacks.put(species.getUID(), beeStack);
}
}
}
@@ -45,9 +45,11 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
List<ItemStack> beeList = new ArrayList<ItemStack>();
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
for (ItemStack beeStack : beeList) {
iconStacks.put(BeeGenome.getSpecies(beeStack).getUID(), beeStack);
IAlleleBeeSpecies species = BeeGenome.getSpecies(beeStack);
if (species != null) {
iconStacks.put(species.getUID(), beeStack);
}
}
}
@Override
@@ -61,14 +61,14 @@ public class ItemHabitatLocator extends ItemInventoried {
private static final short SLOT_ANALYZED = 1;
public Set<BiomeGenBase> biomesToSearch = new HashSet<BiomeGenBase>();
private ItemHabitatLocator habitatLocator;
private final ItemHabitatLocator habitatLocator;
public HabitatLocatorInventory(ItemStack itemstack) {
super(ItemHabitatLocator.class, 3, itemstack);
this.habitatLocator = (ItemHabitatLocator) itemstack.getItem();
}
private boolean isEnergy(ItemStack itemstack) {
private static boolean isEnergy(ItemStack itemstack) {
if (itemstack == null || itemstack.stackSize <= 0) {
return false;
}
@@ -45,13 +45,13 @@ public class TextureHabitatLocator extends TextureAtlasSprite {
Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft.theWorld != null && minecraft.thePlayer != null) {
updateCompass(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ, minecraft.thePlayer.rotationYaw, false, true);
updateCompass(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ, minecraft.thePlayer.rotationYaw);
} else {
updateCompass(null, 0.0d, 0.0d, 0.0d, true, true);
updateCompass(null, 0.0d, 0.0d, 0.0d);
}
}
public void updateCompass(World world, double playerX, double playerZ, double playerYaw, boolean par8, boolean hasSpin) {
public void updateCompass(World world, double playerX, double playerZ, double playerYaw) {
double targetAngle;
@@ -72,31 +72,27 @@ public class TextureHabitatLocator extends TextureAtlasSprite {
}
}
if (!hasSpin) {
currentAngle = targetAngle;
} else {
double angleChange = targetAngle - currentAngle;
while (angleChange < -Math.PI) {
angleChange += (Math.PI * 2D);
}
while (angleChange >= Math.PI) {
angleChange -= (Math.PI * 2D);
}
if (angleChange < -1.0D) {
angleChange = -1.0D;
}
if (angleChange > 1.0D) {
angleChange = 1.0D;
}
this.angleDelta += angleChange * 0.1D;
this.angleDelta *= 0.8D;
this.currentAngle += this.angleDelta;
double angleChange = targetAngle - currentAngle;
while (angleChange < -Math.PI) {
angleChange += (Math.PI * 2D);
}
while (angleChange >= Math.PI) {
angleChange -= (Math.PI * 2D);
}
if (angleChange < -1.0D) {
angleChange = -1.0D;
}
if (angleChange > 1.0D) {
angleChange = 1.0D;
}
this.angleDelta += angleChange * 0.1D;
this.angleDelta *= 0.8D;
this.currentAngle += this.angleDelta;
int i = (int) ((this.currentAngle / (Math.PI * 2D) + 1.0d) * this.framesTextureData.size()) % this.framesTextureData.size();
while (i < 0) {
i = (i + this.framesTextureData.size()) % this.framesTextureData.size();
@@ -58,7 +58,7 @@ public enum HiveDescription implements IHiveDescription {
private final IBeeGenome beeGenome;
private final IHiveGen hiveGen;
private HiveDescription(int meta, float genChance, IAllele[] beeTemplate, IHiveGen hiveGen) {
HiveDescription(int meta, float genChance, IAllele[] beeTemplate, IHiveGen hiveGen) {
this.meta = meta;
this.genChance = genChance;
this.beeGenome = PluginApiculture.beeInterface.templateAsGenome(beeTemplate);
@@ -17,7 +17,7 @@ import forestry.api.apiculture.hives.IHiveGenHelper;
public class HiveGenHelper implements IHiveGenHelper {
private static IHiveGen treeGen = new HiveGenTree();
private static final IHiveGen treeGen = new HiveGenTree();
@Override
public IHiveGen ground(Block... validGroundBlocks) {
@@ -37,7 +37,7 @@ public class FruitProviderNone implements IFruitProvider {
}
}
private static HashMap<String, OverlayType> overlayTypes = new HashMap<String, OverlayType>();
private static final HashMap<String, OverlayType> overlayTypes = new HashMap<String, OverlayType>();
static {
overlayTypes.put("berries", new OverlayType("berries", (short) 1000));
@@ -31,13 +31,13 @@ import forestry.plugins.PluginArboriculture;
public class FruitProviderPod extends FruitProviderNone {
public static enum EnumPodType {
public enum EnumPodType {
COCOA((short) 2000, (short) 2001, (short) 2002), DATES((short) 2010, (short) 2011, (short) 2012),
PAPAYA((short) 2013, (short) 2014, (short) 2015);//, COCONUT((short)2016, (short)2017, (short)2018);
public final short[] uids;
private EnumPodType(short stage1, short stage2, short stage3) {
EnumPodType(short stage1, short stage2, short stage3) {
uids = new short[]{stage1, stage2, stage3};
}
}
@@ -34,11 +34,11 @@ public enum WoodType {
public static final WoodType[] VALUES = values();
private final float hardness;
private WoodType() {
WoodType() {
this(2.0f);
}
private WoodType(float hardness) {
WoodType(float hardness) {
this.hardness = hardness;
}
@@ -36,7 +36,7 @@ import forestry.plugins.PluginArboriculture;
public class BlockArbFence extends BlockFence implements IWoodTyped {
public static enum FenceCat {
public enum FenceCat {
CAT0, CAT1
}
@@ -33,7 +33,7 @@ import forestry.arboriculture.WoodType;
public class BlockPlanks extends Block implements IWoodTyped {
public static enum PlankCat {
public enum PlankCat {
CAT0, CAT1
}
@@ -34,7 +34,7 @@ import forestry.arboriculture.WoodType;
public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyped {
public static enum SlabCat {
public enum SlabCat {
CAT0, CAT1, CAT2, CAT3
}
@@ -72,6 +72,9 @@ public class ForestryBlockLeaves extends BlockNewLeaf implements ITileEntityProv
private static NBTTagCompound getTagCompoundForLeaves(IBlockAccess world, int x, int y, int z) {
TileLeaves leaves = getLeafTile(world, x, y, z);
NBTTagCompound nbttagcompound = new NBTTagCompound();
if (leaves == null) {
return nbttagcompound;
}
leaves.writeToNBT(nbttagcompound);
return nbttagcompound;
}
@@ -25,6 +25,7 @@ import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.arboriculture.IAlleleGrowth;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleInteger;
@@ -49,7 +50,10 @@ public class GuiTreealyzer extends GuiAlyzer {
ArrayList<ItemStack> treeList = new ArrayList<ItemStack>();
((ItemGermlingGE) ForestryItem.sapling.item()).addCreativeItems(treeList, false);
for (ItemStack treeStack : treeList) {
iconStacks.put(TreeGenome.getSpecies(treeStack).getUID(), treeStack);
IAlleleTreeSpecies species = TreeGenome.getSpecies(treeStack);
if (species != null) {
iconStacks.put(species.getUID(), treeStack);
}
}
}
@@ -148,7 +148,7 @@ public class LeavesRenderingHandler extends OverlayRenderingHandler implements I
Tessellator tessellator = Tessellator.instance;
Block block = StackUtils.getBlock(itemStack);
if (!(itemStack.getItem() instanceof ItemLeavesBlock)) {
if (!(itemStack.getItem() instanceof ItemLeavesBlock) || block == null) {
return;
}
@@ -64,11 +64,11 @@ public enum EnumErrorCode implements IErrorState {
@SideOnly(Side.CLIENT)
private IIcon icon;
private EnumErrorCode(String name) {
EnumErrorCode(String name) {
this(name, name);
}
private EnumErrorCode(String name, String iconName) {
EnumErrorCode(String name, String iconName) {
this.name = name;
this.iconName = iconName;
}
+5 -6
View File
@@ -1,6 +1,5 @@
package forestry.core;
public interface IItemTyped {
@SuppressWarnings("rawtypes")
public Enum getTypeFromMeta(int meta);
}
package forestry.core;
public interface IItemTyped {
Enum getTypeFromMeta(int meta);
}
@@ -18,7 +18,7 @@ public enum EnumCircuitBoardType {
final int primaryColor;
final int secondaryColor;
private EnumCircuitBoardType(short sockets, int primaryColor, int secondaryColor) {
EnumCircuitBoardType(short sockets, int primaryColor, int secondaryColor) {
this.sockets = sockets;
this.primaryColor = primaryColor;
this.secondaryColor = secondaryColor;
@@ -29,7 +29,7 @@ public abstract class SubCommand implements IForestryCommand {
EVERYONE(0), ADMIN(2);
public final int permLevel;
private PermLevel(int permLevel) {
PermLevel(int permLevel) {
this.permLevel = permLevel;
}
@@ -325,15 +325,15 @@ public enum Fluids {
private final int density, viscosity;
private final Color color;
private Fluids() {
Fluids() {
this(null);
}
private Fluids(Color color) {
Fluids(Color color) {
this(color, 1000, 1000);
}
private Fluids(Color color, int density, int viscosity) {
Fluids(Color color, int density, int viscosity) {
this.tag = name().toLowerCase(Locale.ENGLISH);
this.color = color;
this.density = density;
@@ -39,11 +39,8 @@ import forestry.core.inventory.TileInventoryAdapter;
import forestry.core.inventory.wrappers.IInvSlot;
import forestry.core.inventory.wrappers.InventoryIterator;
import forestry.core.inventory.wrappers.InventoryMapper;
import forestry.core.network.ForestryPacket;
import forestry.core.network.GuiId;
import forestry.core.network.PacketPayload;
import forestry.core.network.PacketTileUpdate;
import forestry.core.proxy.Proxies;
import forestry.core.utils.GuiUtil;
import forestry.plugins.PluginApiculture;
@@ -215,8 +212,8 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
payload.stringPayload = new String[1];
payload.shortPayload = new short[2];
payload.stringPayload[0] = displayIndividual.getIdent();
payload.shortPayload[0] = (short)type;
payload.shortPayload[1] = (short)displayStack.stackSize;
payload.shortPayload[0] = (short) type;
payload.shortPayload[1] = (short) displayStack.stackSize;
return payload;
}
@@ -49,7 +49,6 @@ import forestry.core.utils.AdjacentTileCache;
import forestry.core.utils.EnumAccess;
import forestry.core.utils.PlayerUtil;
import forestry.core.utils.Utils;
import forestry.core.vect.Vect;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.ITriggerExternal;
@@ -59,7 +58,7 @@ import buildcraft.api.statements.ITriggerProvider;
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
public abstract class TileForestry extends TileEntity implements INetworkedEntity, IRestrictedAccess, IErrorSource, ITriggerProvider, ISidedInventory, IFilterSlotDelegate {
private static Random rand = new Random();
private static final Random rand = new Random();
protected final AdjacentTileCache tileCache = new AdjacentTileCache(this);
protected boolean isInited = false;
@@ -15,7 +15,7 @@ public enum EnumMutateChance {
public final int colour;
private EnumMutateChance(int colour) {
EnumMutateChance(int colour) {
this.colour = colour;
}
@@ -16,8 +16,8 @@ import forestry.core.utils.StringUtil;
public class FruitFamily implements IFruitFamily {
private String uid;
private String scientific;
private final String uid;
private final String scientific;
public FruitFamily(String uid, String scientific) {
this.uid = uid;
@@ -43,7 +43,7 @@ import forestry.core.utils.StringUtil;
public class ItemResearchNote extends ItemForestry {
public static enum EnumNoteType {
public enum EnumNoteType {
NONE, MUTATION, SPECIES;
public static final EnumNoteType[] VALUES = values();
@@ -13,7 +13,7 @@ package forestry.core.interfaces;
import net.minecraft.tileentity.TileEntity;
public interface IBlockRenderer {
public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f);
void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f);
public void inventoryRender(double x, double y, double z, float f, float f1);
void inventoryRender(double x, double y, double z, float f, float f1);
}
@@ -8,5 +8,5 @@ import forestry.core.interfaces.IFilterSlotDelegate;
public interface IInventoryAdapter extends ISidedInventory, IFilterSlotDelegate, INBTTagable {
/* Sided */
public IInventoryAdapter configureSided(int[] sides, int[] slots);
IInventoryAdapter configureSided(int[] sides, int[] slots);
}
@@ -17,6 +17,6 @@ import net.minecraft.tileentity.TileEntity;
*/
public interface ITileFilter {
public boolean matches(TileEntity tile);
boolean matches(TileEntity tile);
}
@@ -1,154 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* 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.inventory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.minecraft.item.ItemStack;
/**
* This is a custom data structure designed specifically for using ItemStacks as
* elements of a Set.
*
* Its backed by an ArrayList, so as expected, most operations result in
* traversing the list one or more times.
*
* @author CovertJaguar <http://www.railcraft.info>
*/
public class ItemStackSet implements Set<ItemStack> {
private final List<ItemStack> set = new ArrayList<ItemStack>();
@Override
public int size() {
return set.size();
}
@Override
public boolean isEmpty() {
return set.isEmpty();
}
@Override
public boolean contains(Object obj) {
if (!(obj instanceof ItemStack)) {
return false;
}
ItemStack check = (ItemStack) obj;
for (ItemStack stack : set) {
if (InvTools.isItemEqual(stack, check)) {
return true;
}
}
return false;
}
@Override
public Iterator<ItemStack> iterator() {
return set.iterator();
}
@Override
public Object[] toArray() {
return set.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
return set.toArray(a);
}
@Override
public boolean add(ItemStack e) {
if (contains(e)) {
return false;
}
set.add(e);
return true;
}
@Override
public boolean remove(Object obj) {
if (!(obj instanceof ItemStack)) {
return false;
}
boolean changed = false;
ItemStack check = (ItemStack) obj;
Iterator<ItemStack> it = set.iterator();
while (it.hasNext()) {
ItemStack stack = it.next();
if (InvTools.isItemEqual(stack, check)) {
it.remove();
changed = true;
}
}
return changed;
}
@Override
public boolean containsAll(Collection<?> c) {
for (Object obj : c) {
if (!(obj instanceof ItemStack)) {
return false;
}
if (!contains(obj)) {
return false;
}
}
return true;
}
@Override
public boolean addAll(Collection<? extends ItemStack> c) {
boolean changed = false;
for (ItemStack stack : c) {
changed |= add(stack);
}
return changed;
}
@Override
public boolean retainAll(Collection<?> c) {
boolean changed = false;
Iterator<ItemStack> it = set.iterator();
while (it.hasNext()) {
ItemStack stack = it.next();
if (!c.contains(stack)) {
it.remove();
changed = true;
}
}
return changed;
}
@Override
public boolean removeAll(Collection<?> c) {
boolean changed = false;
Iterator<ItemStack> it = set.iterator();
while (it.hasNext()) {
ItemStack stack = it.next();
if (c.contains(stack)) {
it.remove();
changed = true;
}
}
return changed;
}
@Override
public void clear() {
set.clear();
}
}
@@ -21,5 +21,5 @@ import net.minecraft.item.ItemStack;
*/
public interface IStackFilter {
public boolean matches(ItemStack stack);
boolean matches(ItemStack stack);
}
@@ -12,8 +12,8 @@ package forestry.core.network;
public interface INetworkedEntity {
public void sendNetworkUpdate();
void sendNetworkUpdate();
public void fromPacket(ForestryPacket packet);
void fromPacket(ForestryPacket packet);
}
@@ -22,18 +22,18 @@ import forestry.core.proxy.Proxies;
public class PacketFXSignal extends ForestryPacket {
public static enum VisualFXType {
public enum VisualFXType {
NONE, BLOCK_DESTROY, SAPLING_PLACE
}
public static enum SoundFXType {
public enum SoundFXType {
NONE(""), BLOCK_DESTROY(""), BLOCK_PLACE(""), LEAF("step.grass"), LOG("dig.wood"), DIRT("dig.gravel");
public final String soundFile;
public final float volume = 1.0f;
public final float pitch = 1.0f;
private SoundFXType(String soundFile) {
SoundFXType(String soundFile) {
this.soundFile = soundFile;
}
}
@@ -28,7 +28,7 @@ import forestry.core.interfaces.IBlockRenderer;
public class RenderAnalyzer extends TileEntitySpecialRenderer implements IBlockRenderer {
private ModelAnalyzer model;
private final ModelAnalyzer model;
private final EntityItem dummyEntityItem = new EntityItem(null);
private final RenderItem customRenderItem;
private long lastTick;
@@ -36,7 +36,7 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe
private final ModelRenderer resourceTank;
private final ModelRenderer productTank;
private static enum Textures {
private enum Textures {
BASE,
TANK_R_EMPTY, TANK_R_LOW, TANK_R_MEDIUM, TANK_R_HIGH, TANK_R_MAXIMUM,
TANK_P_EMPTY, TANK_P_LOW, TANK_P_MEDIUM, TANK_P_HIGH, TANK_P_MAXIMUM
@@ -115,46 +115,35 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe
EnumTankLevel melangeLevel = EnumTankLevel.values()[melangeLevelInt];
GL11.glPushMatrix();
// GL11.glDisable(2896 /* GL_LIGHTING */);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef((float) x, (float) y, (float) z);
float[] angle = {0, 0, 0};
float[] translate = {0, 0, 0};
if (orientation == null) {
orientation = ForgeDirection.WEST;
}
switch (orientation) {
case EAST:
// angle [2] = (float) Math.PI / 2;
angle[1] = (float) Math.PI;
angle[2] = (float) -Math.PI / 2;
translate[0] = 1;
break;
case WEST:
// 2, -PI/2
angle[2] = (float) Math.PI / 2;
translate[0] = -1;
break;
case UP:
translate[1] = 1;
break;
case DOWN:
angle[2] = (float) Math.PI;
translate[1] = -1;
break;
case SOUTH:
angle[0] = (float) Math.PI / 2;
angle[2] = (float) Math.PI / 2;
translate[2] = 1;
break;
case NORTH:
default:
angle[0] = (float) -Math.PI / 2;
angle[2] = (float) Math.PI / 2;
translate[2] = -1;
break;
}
@@ -226,7 +215,6 @@ public class RenderMachine extends TileEntitySpecialRenderer implements IBlockRe
Proxies.common.bindTexture(texture);
productTank.render(factor);
// GL11.glEnable(2896 /* GL_LIGHTING */);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@@ -30,7 +30,7 @@ public class RenderMill extends TileEntitySpecialRenderer implements IBlockRende
private final ModelBase model = new ModelBase() {
};
private static enum Textures {PEDESTAL, EXTENSION, BLADE_1, BLADE_2, CHARGE}
private enum Textures {PEDESTAL, EXTENSION, BLADE_1, BLADE_2, CHARGE}
private ResourceLocation[] textures;
@@ -34,7 +34,7 @@ public final class AdjacentTileCache {
private final TileEntity source;
private final Set<ICacheListener> listeners = new LinkedHashSet<ICacheListener>();
public static interface ICacheListener {
public interface ICacheListener {
void changed();
@@ -23,7 +23,7 @@ public enum EnumAccess {
@SideOnly(Side.CLIENT)
private IIcon icon;
private EnumAccess(String name) {
EnumAccess(String name) {
this.name = name;
}
+34 -81
View File
@@ -10,8 +10,6 @@
******************************************************************************/
package forestry.core.utils;
import java.security.MessageDigest;
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.Random;
@@ -23,10 +21,8 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryLargeChest;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -37,7 +33,6 @@ import forestry.api.core.ForestryAPI;
import forestry.api.core.ITileStructure;
import forestry.core.gadgets.TileForestry;
import forestry.core.proxy.Proxies;
import forestry.core.vect.Vect;
import buildcraft.api.tools.IToolWrench;
@@ -109,26 +104,6 @@ public class Utils {
}
public static IInventory getChest(IInventory inventory) {
if (!(inventory instanceof TileEntityChest)) {
return inventory;
}
TileEntityChest chest = (TileEntityChest) inventory;
Vect[] adjacent = new Vect[]{new Vect(chest.xCoord + 1, chest.yCoord, chest.zCoord), new Vect(chest.xCoord - 1, chest.yCoord, chest.zCoord),
new Vect(chest.xCoord, chest.yCoord, chest.zCoord + 1), new Vect(chest.xCoord, chest.yCoord, chest.zCoord - 1)};
for (Vect pos : adjacent) {
TileEntity otherchest = chest.getWorldObj().getTileEntity(pos.x, pos.y, pos.z);
if (otherchest instanceof TileEntityChest) {
return new InventoryLargeChest("", chest, (TileEntityChest) otherchest);
}
}
return inventory;
}
public static <T> T[] concat(T[] first, T[] second) {
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
@@ -165,11 +140,7 @@ public class Utils {
}
IToolWrench wrench = (IToolWrench) itemstack.getItem();
if (!wrench.canWrench(player, x, y, z)) {
return false;
}
return true;
return wrench.canWrench(player, x, y, z);
}
public static void useWrench(EntityPlayer player, int x, int y, int z) {
@@ -212,14 +183,6 @@ public class Utils {
|| block.getMaterial().isReplaceable();
}
public static boolean isLiquidBlock(World world, int x, int y, int z) {
return isLiquidBlock(world.getBlock(x, y, z));
}
public static boolean isLiquidBlock(Block block) {
return block == Blocks.water || block == Blocks.flowing_water || block == Blocks.lava || block == Blocks.flowing_lava;
}
public static boolean isUseableByPlayer(EntityPlayer player, TileEntity tile) {
int x = tile.xCoord;
int y = tile.yCoord;
@@ -242,28 +205,45 @@ public class Utils {
return world.getBiomeGenForCoordsBody(x, z);
}
public static Entity spawnEntity(World world, Class<? extends Entity> entityClass, double x, double y, double z) {
private static <E extends EntityLiving> E createEntity(World world, Class<E> entityClass) {
if (!EntityList.classToStringMapping.containsKey(entityClass)) {
return null;
}
return spawnEntity(world, EntityList.createEntityByName((String) EntityList.classToStringMapping.get(entityClass), world), x, y, z);
}
public static Entity spawnEntity(World world, Entity spawn, double x, double y, double z) {
if (spawn != null && spawn instanceof EntityLiving) {
EntityLiving living = (EntityLiving) spawn;
spawn.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0f), 0.0f);
living.rotationYawHead = living.rotationYaw;
living.renderYawOffset = living.rotationYaw;
living.onSpawnWithEgg(null);
world.spawnEntityInWorld(spawn);
living.playLivingSound();
String entityString = (String) EntityList.classToStringMapping.get(entityClass);
if (entityString == null) {
return null;
}
return spawn;
Entity entity = EntityList.createEntityByName(entityString, world);
if (entity == null) {
return null;
}
//noinspection unchecked
return (E) entity;
}
public static <E extends EntityLiving> E spawnEntity(World world, Class<E> entityClass, double x, double y, double z) {
E entityLiving = createEntity(world, entityClass);
if (entityLiving == null) {
return null;
}
return spawnEntity(world, entityLiving, x, y, z);
}
public static <E extends EntityLiving> E spawnEntity(World world, E living, double x, double y, double z) {
if (living == null) {
return null;
}
living.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0f), 0.0f);
living.rotationYawHead = living.rotationYaw;
living.renderYawOffset = living.rotationYaw;
living.onSpawnWithEgg(null);
world.spawnEntityInWorld(living);
living.playLivingSound();
return living;
}
public static void registerEntity(Class<? extends Entity> entityClass, String ident, int id, int eggForeground, int eggBackground, int trackingRange, int updateFrequency, boolean sendVelocity) {
@@ -294,31 +274,4 @@ public class Utils {
return ((r & 0x0ff) << 16) | ((g & 0x0ff) << 8) | (b & 0x0ff);
}
public static String getFingerprint(Certificate certificate) {
if (certificate == null) {
return "Certificate invalid";
}
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] der = certificate.getEncoded();
md.update(der);
byte[] digest = md.digest();
return tohex(digest);
} catch (Exception ex) {
return null;
}
}
private static final String HEX = "0123456789abcdef";
private static String tohex(byte[] checksum) {
final StringBuilder hex = new StringBuilder(2 * checksum.length);
for (byte bty : checksum) {
hex.append(HEX.charAt((bty & 0xf0) >> 4)).append(HEX.charAt((bty & 0x0f)));
}
return hex.toString();
}
}
@@ -36,7 +36,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IBlockRen
private final ModelRenderer piston;
private final ModelRenderer extension;
private static enum Textures {
private enum Textures {
BASE, PISTON, EXTENSION, TRUNK_HIGHEST, TRUNK_HIGHER, TRUNK_HIGH, TRUNK_MEDIUM, TRUNK_LOW
}
@@ -446,7 +446,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
// Need at least one matched set
ItemStack[] set = InvTools.getStacks(craftingInventory, SLOT_CRAFTING_1, SLOT_CRAFTING_COUNT);
ItemStack[] stock = InvTools.getStacks(accessibleInventory, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT);
;
return StackUtils.containsSets(set, stock, true, false) > 0;
}
@@ -108,11 +108,6 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
return false;
}
// No liquid required
if (liquid == null) {
return true;
}
// Liquid required but none given
if (liqu == null) {
return false;
@@ -13,6 +13,7 @@ package forestry.farming.gadgets;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityDiggingFX;
@@ -200,7 +201,12 @@ public class BlockFarm extends BlockStructure {
@SideOnly(Side.CLIENT)
public IIcon getBlockTextureFromSideAndMetadata(EnumFarmBlock type, int side, int metadata) {
return StackUtils.getBlock(type.getBase()).getIcon(side, type.getBase().getItemDamage());
Block block = StackUtils.getBlock(type.getBase());
if (block == null) {
return null;
}
int damage = type.getBase().getItemDamage();
return block.getIcon(side, damage);
}
@SideOnly(Side.CLIENT)
@@ -244,6 +250,11 @@ public class BlockFarm extends BlockStructure {
base = ((TileFarm) tile).farmBlock.getBase();
}
return StackUtils.getBlock(base).getIcon(side, base.getItemDamage());
Block block = StackUtils.getBlock(base);
if (block == null) {
return null;
}
return block.getIcon(side, base.getItemDamage());
}
}
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.farming.gadgets;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.List;
@@ -57,7 +58,7 @@ public enum EnumFarmBlock {
private final ItemStack base;
private EnumFarmBlock(ItemStack base) {
EnumFarmBlock(ItemStack base) {
this.base = base;
}
@@ -45,15 +45,12 @@ import forestry.core.vect.VectUtil;
public class FarmLogicArboreal extends FarmLogicHomogeneous {
public FarmLogicArboreal(IFarmHousing housing, ItemStack[] resource, ItemStack ground, IFarmable[] germlings) {
public FarmLogicArboreal(IFarmHousing housing, ItemStack resource, ItemStack ground, Iterable<IFarmable> germlings) {
super(housing, resource, ground, germlings);
}
public FarmLogicArboreal(IFarmHousing housing) {
super(housing,
new ItemStack[]{new ItemStack(Blocks.dirt)},
ForestryBlock.soil.getItemStack(1, 0),
Farmables.farmables.get("farmArboreal").toArray(new IFarmable[0]));
super(housing, new ItemStack(Blocks.dirt), ForestryBlock.soil.getItemStack(1, 0), Farmables.farmables.get("farmArboreal"));
}
@Override
@@ -23,7 +23,7 @@ import forestry.api.farming.IFarmable;
public class FarmLogicCereal extends FarmLogicCrops {
public FarmLogicCereal(IFarmHousing housing) {
super(housing, Farmables.farmables.get("farmWheat").toArray(new IFarmable[0]));
super(housing, Farmables.farmables.get("farmWheat"));
}
@Override
@@ -36,13 +36,11 @@ import forestry.core.vect.VectUtil;
public abstract class FarmLogicCrops extends FarmLogicWatered {
private final IFarmable[] seeds;
private final Iterable<IFarmable> seeds;
private static final ItemStack farmland = new ItemStack(Blocks.farmland, 1, Defaults.WILDCARD);
public FarmLogicCrops(IFarmHousing housing, IFarmable[] seeds) {
super(housing,
new ItemStack[]{new ItemStack(Blocks.dirt)},
new ItemStack(Blocks.farmland));
public FarmLogicCrops(IFarmHousing housing, Iterable<IFarmable> seeds) {
super(housing, new ItemStack(Blocks.dirt), new ItemStack(Blocks.farmland));
this.seeds = seeds;
}
@@ -35,11 +35,7 @@ import forestry.core.vect.VectUtil;
public class FarmLogicEnder extends FarmLogicHomogeneous {
public FarmLogicEnder(IFarmHousing housing) {
super(housing,
new ItemStack[]{new ItemStack(Blocks.end_stone)},
new ItemStack(Blocks.end_stone),
Farmables.farmables.get("farmEnder").toArray(new IFarmable[0]));
super(housing, new ItemStack(Blocks.end_stone), new ItemStack(Blocks.end_stone), Farmables.farmables.get("farmEnder"));
}
@Override
@@ -28,13 +28,13 @@ import forestry.farming.gadgets.StructureLogicFarm;
public abstract class FarmLogicHomogeneous extends FarmLogic {
protected final ItemStack[] resource;
protected final ItemStack resource;
protected final ItemStack soilBlock;
protected final IFarmable[] germlings;
protected final Iterable<IFarmable> germlings;
ArrayList<ItemStack> produce = new ArrayList<ItemStack>();
public FarmLogicHomogeneous(IFarmHousing housing, ItemStack[] resource, ItemStack soilBlock, IFarmable[] germlings) {
public FarmLogicHomogeneous(IFarmHousing housing, ItemStack resource, ItemStack soilBlock, Iterable<IFarmable> germlings) {
super(housing);
this.resource = resource;
this.soilBlock = soilBlock;
@@ -47,7 +47,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
@Override
public boolean isAcceptedResource(ItemStack itemstack) {
return resource[0].isItemEqual(itemstack);
return resource.isItemEqual(itemstack);
}
@Override
@@ -84,7 +84,8 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
}
private boolean maintainSoil(int x, int yGround, int z, ForgeDirection direction, int extent) {
if (!housing.hasResources(resource)) {
ItemStack[] resources = new ItemStack[]{resource};
if (!housing.hasResources(resources)) {
return false;
}
@@ -113,7 +114,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic {
produce.addAll(BlockUtil.getBlockDrops(world, position));
setBlock(position, StackUtils.getBlock(soilBlock), soilBlock.getItemDamage());
housing.removeResources(resource);
housing.removeResources(resources);
return true;
}
@@ -35,10 +35,7 @@ import forestry.core.vect.VectUtil;
public class FarmLogicInfernal extends FarmLogicHomogeneous {
public FarmLogicInfernal(IFarmHousing housing) {
super(housing,
new ItemStack[]{new ItemStack(Blocks.soul_sand)},
new ItemStack(Blocks.soul_sand),
Farmables.farmables.get("farmInfernal").toArray(new IFarmable[0]));
super(housing, new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.soul_sand), Farmables.farmables.get("farmInfernal"));
}
@Override
@@ -34,8 +34,7 @@ import forestry.core.vect.VectUtil;
public class FarmLogicPeat extends FarmLogicWatered {
public FarmLogicPeat(IFarmHousing housing) {
super(housing, new ItemStack[]{ForestryBlock.soil.getItemStack(1, 1)},
ForestryBlock.soil.getItemStack(1, 1));
super(housing, ForestryBlock.soil.getItemStack(1, 1), ForestryBlock.soil.getItemStack(1, 1));
}
@Override
@@ -27,10 +27,7 @@ import forestry.api.farming.IFarmable;
public class FarmLogicShroom extends FarmLogicArboreal {
public FarmLogicShroom(IFarmHousing housing) {
super(housing,
new ItemStack[]{new ItemStack(Blocks.mycelium)},
new ItemStack(Blocks.mycelium),
Farmables.farmables.get("farmShroom").toArray(new IFarmable[0]));
super(housing, new ItemStack(Blocks.mycelium), new ItemStack(Blocks.mycelium), Farmables.farmables.get("farmShroom"));
yOffset = -1;
}
@@ -23,7 +23,7 @@ import forestry.api.farming.IFarmable;
public class FarmLogicVegetable extends FarmLogicCrops {
public FarmLogicVegetable(IFarmHousing housing) {
super(housing, Farmables.farmables.get("farmVegetables").toArray(new IFarmable[0]));
super(housing, Farmables.farmables.get("farmVegetables"));
}
@Override
@@ -32,13 +32,13 @@ import forestry.core.vect.VectUtil;
public abstract class FarmLogicWatered extends FarmLogic {
protected final ItemStack ground;
private final ItemStack[] resource;
private final ItemStack resource;
private static final FluidStack STACK_WATER = Fluids.WATER.getFluid(1000);
ArrayList<ItemStack> produce = new ArrayList<ItemStack>();
public FarmLogicWatered(IFarmHousing housing, ItemStack[] resource, ItemStack ground) {
public FarmLogicWatered(IFarmHousing housing, ItemStack resource, ItemStack ground) {
super(housing);
this.ground = ground;
this.resource = resource;
@@ -60,7 +60,7 @@ public abstract class FarmLogicWatered extends FarmLogic {
@Override
public boolean isAcceptedResource(ItemStack itemstack) {
return resource[0].isItemEqual(itemstack);
return resource.isItemEqual(itemstack);
}
@Override
@@ -91,6 +91,7 @@ public abstract class FarmLogicWatered extends FarmLogic {
private boolean maintainSoil(int x, int y, int z, ForgeDirection direction, int extent) {
World world = getWorld();
ItemStack[] resources = new ItemStack[]{resource};
for (int i = 0; i < extent; i++) {
Vect position = translateWithOffset(x, y, z, direction, i);
@@ -98,7 +99,7 @@ public abstract class FarmLogicWatered extends FarmLogic {
if (!isAirBlock(block) && !Utils.isReplaceableBlock(block)) {
ItemStack blockStack = VectUtil.getAsItemStack(world, position);
if (!isAcceptedGround(blockStack) && housing.hasResources(resource)) {
if (!isAcceptedGround(blockStack) && housing.hasResources(resources)) {
produce.addAll(BlockUtil.getBlockDrops(getWorld(), position));
setBlock(position, Blocks.air, 0);
return trySetSoil(position);
@@ -140,11 +141,12 @@ public abstract class FarmLogicWatered extends FarmLogic {
}
private boolean trySetSoil(Vect position) {
if (!housing.hasResources(resource)) {
ItemStack[] resources = new ItemStack[]{resource};
if (!housing.hasResources(resources)) {
return false;
}
setBlock(position, StackUtils.getBlock(ground), ground.getItemDamage());
housing.removeResources(resource);
housing.removeResources(resources);
return true;
}
@@ -32,6 +32,9 @@ public class FarmItemRenderer implements IItemRenderer {
Tessellator tessellator = Tessellator.instance;
BlockFarm block = (BlockFarm) StackUtils.getBlock(item);
if (block == null) {
return;
}
block.setBlockBoundsForItemRender();
render.setRenderBoundsFromBlock(block);
@@ -47,14 +47,18 @@ public class AIButterflyPollinate extends AIButterflyInteract {
public void updateTask() {
if (continueExecuting()) {
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(entity.worldObj, rest.posX, rest.posY, rest.posZ);
if (entity.getPollen() == null) {
entity.setPollen(checkPollinatable.getPollen());
// Proxies.log.finest("A butterfly '%s' grabbed a pollen '%s' at %s/%s/%s.", entity.getButterfly().getIdent(), entity.getPollen().getIdent(), rest.posX, rest.posY, rest.posZ);
} else if (checkPollinatable.canMateWith(entity.getPollen())) {
IPollinatable realPollinatable = GeneticsUtil.getOrCreatePollinatable(null, entity.worldObj, rest.posX, rest.posY, rest.posZ);
realPollinatable.mateWith(entity.getPollen());
// Proxies.log.finest("A butterfly '%s' unloaded pollen '%s' at %s/%s/%s.", entity.getButterfly().getIdent(), entity.getPollen().getIdent(), rest.posX, rest.posY, rest.posZ);
entity.setPollen(null);
if (checkPollinatable != null) {
if (entity.getPollen() == null) {
entity.setPollen(checkPollinatable.getPollen());
// Proxies.log.finest("A butterfly '%s' grabbed a pollen '%s' at %s/%s/%s.", entity.getButterfly().getIdent(), entity.getPollen().getIdent(), rest.posX, rest.posY, rest.posZ);
} else if (checkPollinatable.canMateWith(entity.getPollen())) {
IPollinatable realPollinatable = GeneticsUtil.getOrCreatePollinatable(null, entity.worldObj, rest.posX, rest.posY, rest.posZ);
if (realPollinatable != null) {
realPollinatable.mateWith(entity.getPollen());
// Proxies.log.finest("A butterfly '%s' unloaded pollen '%s' at %s/%s/%s.", entity.getButterfly().getIdent(), entity.getPollen().getIdent(), rest.posX, rest.posY, rest.posZ);
entity.setPollen(null);
}
}
}
setHasInteracted();
entity.cooldownPollination = EntityButterfly.COOLDOWNS;
@@ -60,7 +60,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
public final boolean doesMovement;
private EnumButterflyState(boolean doesMovement) {
EnumButterflyState(boolean doesMovement) {
this.doesMovement = doesMovement;
}
@@ -15,7 +15,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map.Entry;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -148,8 +147,8 @@ public class ButterflyHelper extends SpeciesRoot implements IButterflyRoot {
}
@Override
public EntityLiving spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z) {
return (EntityButterfly) Utils.spawnEntity(world, new EntityButterfly(world, butterfly), x, y, z);
public EntityButterfly spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z) {
return Utils.spawnEntity(world, new EntityButterfly(world, butterfly), x, y, z);
}
@Override
@@ -25,6 +25,7 @@ import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IMutation;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterfly;
import forestry.core.config.ForestryItem;
import forestry.core.genetics.AlleleBoolean;
@@ -45,9 +46,11 @@ public class GuiFlutterlyzer extends GuiAlyzer {
ArrayList<ItemStack> butterflyList = new ArrayList<ItemStack>();
((ItemButterflyGE) ForestryItem.butterflyGE.item()).addCreativeItems(butterflyList, false);
for (ItemStack butterflyStack : butterflyList) {
iconStacks.put(ButterflyGenome.getSpecies(butterflyStack).getUID(), butterflyStack);
IAlleleButterflySpecies species = ButterflyGenome.getSpecies(butterflyStack);
if (species != null) {
iconStacks.put(species.getUID(), butterflyStack);
}
}
}
@Override
@@ -263,40 +266,38 @@ public class GuiFlutterlyzer extends GuiAlyzer {
newLine();
newLine();
RenderHelper.enableGUIStandardItemLighting();
HashMap<IMutation, IAllele> combinations = new HashMap<IMutation, IAllele>();
/*
for (IMutation mutation : TreeTemplates.getCombinations(butterfly.getGenome().getPrimary()))
combinations.put(mutation, butterfly.getGenome().getPrimary());
for (IMutation mutation : TreeTemplates.getCombinations(butterfly.getGenome().getSecondary()))
combinations.put(mutation, butterfly.getGenome().getSecondary());
*/
int columnWidth = 50;
int x = 0;
for (Map.Entry<IMutation, IAllele> mutation : combinations.entrySet()) {
//if (breedingTracker.isDiscovered(mutation.getKey()))
drawMutationInfo(mutation.getKey(), mutation.getValue(), COLUMN_0 + x);
/*else {
// Do not display secret undiscovered mutations.
if (mutation.getKey().isSecret())
continue;
drawUnknownMutation(mutation.getKey(), mutation.getValue(), COLUMN_0 + x);
} */
x += columnWidth;
if (x > 150) {
x = 0;
newLine();
newLine();
}
}
// RenderHelper.enableGUIStandardItemLighting();
//
// HashMap<IMutation, IAllele> combinations = new HashMap<IMutation, IAllele>();
//
// for (IMutation mutation : TreeTemplates.getCombinations(butterfly.getGenome().getPrimary()))
// combinations.put(mutation, butterfly.getGenome().getPrimary());
//
// for (IMutation mutation : TreeTemplates.getCombinations(butterfly.getGenome().getSecondary()))
// combinations.put(mutation, butterfly.getGenome().getSecondary());
//
// int columnWidth = 50;
// int x = 0;
//
// for (Map.Entry<IMutation, IAllele> mutation : combinations.entrySet()) {
//
// //if (breedingTracker.isDiscovered(mutation.getKey()))
// drawMutationInfo(mutation.getKey(), mutation.getValue(), COLUMN_0 + x);
// /*else {
// // Do not display secret undiscovered mutations.
// if (mutation.getKey().isSecret())
// continue;
//
// drawUnknownMutation(mutation.getKey(), mutation.getValue(), COLUMN_0 + x);
// } */
//
// x += columnWidth;
// if (x > 150) {
// x = 0;
// newLine();
// newLine();
// }
// }
endPage();
@@ -45,7 +45,7 @@ import forestry.plugins.PluginLepidopterology;
public class ItemButterflyGE extends ItemGE {
private static Random rand = new Random();
private static final Random rand = new Random();
private final EnumFlutterType type;
@@ -96,11 +96,11 @@ public class PluginManager {
private final ForestryPlugin instance;
private final boolean canBeDisabled;
private Module(ForestryPlugin plugin) {
Module(ForestryPlugin plugin) {
this(plugin, true);
}
private Module(ForestryPlugin plugin, boolean canBeDisabled) {
Module(ForestryPlugin plugin, boolean canBeDisabled) {
this.instance = plugin;
this.canBeDisabled = canBeDisabled;
}
@@ -99,12 +99,7 @@ public class BackpackDefinition implements IBackpackDefinition {
// isValidItem can get called multiple times per tick if the player's inventory is full
// and they are standing on multiple items.
// It is a slow call, so we need a cache to make it fast
private Map<ItemStack, Boolean> isValidItemCache = new LinkedHashMap<ItemStack, Boolean>() {
@Override
protected boolean removeEldestEntry(Map.Entry<ItemStack, Boolean> eldest) {
return size() > 64;
}
};
private final Map<ItemStack, Boolean> isValidItemCache = new ValidItemCache();
@Override
public boolean isValidItem(EntityPlayer player, ItemStack itemstack) {
@@ -128,4 +123,11 @@ public class BackpackDefinition implements IBackpackDefinition {
isValidItemCache.put(itemstack, false);
return false;
}
private static class ValidItemCache extends LinkedHashMap<ItemStack, Boolean> {
@Override
protected boolean removeEldestEntry(Map.Entry<ItemStack, Boolean> eldest) {
return size() > 64;
}
}
}