Fixed #440 - Filter NPE
This commit is contained in:
parent
ae0012882f
commit
e4d704637a
4 changed files with 49 additions and 6 deletions
|
@ -9,6 +9,7 @@ import net.minecraft.entity.item.EntityItem;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
|
@ -67,10 +68,13 @@ public class TileFilter extends TileFilterable implements IFilterable
|
|||
/**
|
||||
* Toggle item filter render
|
||||
*/
|
||||
List<ItemStack> filteredStacks = ItemImprint.getFilterList(getFilter());
|
||||
if (getFilter() != null)
|
||||
{
|
||||
List<ItemStack> filteredStacks = ItemImprint.getFilterList(getFilter());
|
||||
|
||||
if (filteredStacks.size() > 0)
|
||||
renderIndex = (renderIndex + 1) % filteredStacks.size();
|
||||
if (filteredStacks.size() > 0)
|
||||
renderIndex = (renderIndex + 1) % filteredStacks.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fluid filters
|
||||
|
@ -160,6 +164,12 @@ public class TileFilter extends TileFilterable implements IFilterable
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
return access.getBlockId(x, y, z) == block.blockID ? false : super.shouldSideBeRendered(access, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ dir.mcp=${dir.development}forge/mcp
|
|||
version.minecraft=1.6.4
|
||||
version.forge=9.11.1.964
|
||||
version.universalelectricity=3.1.+
|
||||
version.calclaviacore=1.1.+
|
||||
version.calclaviacore=1.2.+
|
||||
version.cclib=1.0.0.61
|
||||
version.cccore=0.9.0.9
|
||||
version.fmp=1.0.0.244
|
||||
|
|
|
@ -19,7 +19,7 @@ public class MultipartMechanical implements IPartFactory
|
|||
MultiPartRegistry.registerParts(this, PART_TYPES);
|
||||
MultipartGenerator.registerPassThroughInterface("resonantinduction.core.grid.fluid.IPressureNodeProvider");
|
||||
// TODO: Move to UE
|
||||
MultipartGenerator.registerTrait("calclavia.lib.grid.INodeProvider", "calclavia.lib.grid.TraitNodeProvider");
|
||||
MultipartGenerator.registerTrait("calclavia.lib.grid.INodeProvider", "resonantinduction.core.grid.TraitNodeProvider");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package resonantinduction.core.grid;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import calclavia.lib.grid.INode;
|
||||
import calclavia.lib.grid.INodeProvider;
|
||||
import codechicken.multipart.PartMap;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
//TODO: Move to UE 3.2
|
||||
public class TraitNodeProvider extends TileMultipart implements INodeProvider
|
||||
{
|
||||
@Override
|
||||
public <N extends INode> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
TMultiPart part = this.partMap(from.ordinal());
|
||||
|
||||
if (part == null)
|
||||
{
|
||||
part = partMap(PartMap.CENTER.ordinal());
|
||||
}
|
||||
|
||||
if (part instanceof INodeProvider)
|
||||
{
|
||||
return ((INodeProvider) part).getNode(nodeType, from);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue