Java Code Examples for codechicken.multipart.TileMultipart#getTile()

The following examples show how to use codechicken.multipart.TileMultipart#getTile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrameMovementRegistry.java    From Framez with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<IFrame> findFrames(World world, int x, int y, int z) {

    if (world == null)
        return null;

    List<IFrame> l = new ArrayList<IFrame>();

    Block b = world.getBlock(x, y, z);
    if (b instanceof IFrame)
        l.add((IFrame) b);

    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof IFrame)
        l.add((IFrame) te);

    TileMultipart tmp = TileMultipart.getTile(world, new BlockCoord(x, y, z));
    if (tmp != null)
        for (TMultiPart p : tmp.jPartList())
            if (p instanceof IFrame)
                l.add((IFrame) p);// FIXME actual multipart handling

    return l;
}
 
Example 2
Source File: MovementHandlerFMP.java    From Framez with GNU General Public License v3.0 6 votes vote down vote up
@Override
@Priority(PriorityEnum.OVERRIDE)
public BlockMovementType getMovementType(World world, int x, int y, int z, ForgeDirection side, IMovement movement) {

    TileMultipart tmp = TileMultipart.getTile(world, new BlockCoord(x, y, z));
    if (tmp == null)
        return null;

    for (TMultiPart p : tmp.jPartList()) {
        if (p instanceof TSlottedPart) {
            int slot = ((TSlottedPart) p).getSlotMask();
            if (slot == PartMap.face(side.ordinal()).mask && (p instanceof FaceMicroblock || p instanceof HollowMicroblock)) {
                if (((CommonMicroblock) p).getSize() == 1)
                    return BlockMovementType.UNMOVABLE;
            }
        }
    }

    return null;
}
 
Example 3
Source File: MovementHandlerFMP.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ISticky getStickyAt(World world, int x, int y, int z) {

    TileMultipart tmp = TileMultipart.getTile(world, new BlockCoord(x, y, z));
    if (tmp != null)
        return StickyHandlerFMP.instance();
    return null;
}
 
Example 4
Source File: StickyHandlerFMP.java    From Framez with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isSideSticky(World world, int x, int y, int z, ForgeDirection side, IMovement movement) {

    TileMultipart tmp = TileMultipart.getTile(world, new BlockCoord(x, y, z));
    if (tmp == null)
        return false;

    boolean is = false;

    for (TMultiPart p : tmp.jPartList()) {
        if (p instanceof TSlottedPart) {
            int slot = ((TSlottedPart) p).getSlotMask();
            if (PartMap.face(side.ordinal()).mask == slot) {
                if (p instanceof ISticky) {
                    return ((ISticky) p).isSideSticky(world, x, y, z, side, movement);
                } else if (p instanceof FaceMicroblock || p instanceof HollowMicroblock) {
                    if (((CommonMicroblock) p).getSize() == 1)
                        return false;
                }
            } else if (slot == PartMap.CENTER.mask && p instanceof ISticky)
                return ((ISticky) p).isSideSticky(world, x, y, z, side, movement);
        } else if (p instanceof ISticky)
            is |= ((ISticky) p).isSideSticky(world, x, y, z, side, movement);
    }

    return is;
}
 
Example 5
Source File: MovementHandlerFMP.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean canHandle(World world, int x, int y, int z) {

    return TileMultipart.getTile(world, new BlockCoord(x, y, z)) != null;
}