Search in sources :

Example 1 with TileEntityOmnidirectionalHopper

use of pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper in project PneumaticCraft by MineMaarten.

the class ModelOmnidirectionalHopper method renderStatic.

@Override
public void renderStatic(float size, TileEntity tile) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(1, 1, 1, 1);
    TileEntityOmnidirectionalHopper te = null;
    if (tile instanceof TileEntityOmnidirectionalHopper) {
        te = (TileEntityOmnidirectionalHopper) tile;
        PneumaticCraftUtils.rotateMatrixByMetadata(te.getDirection().getOpposite().ordinal());
    } else {
        PneumaticCraftUtils.rotateMatrixByMetadata(ForgeDirection.DOWN.ordinal());
    }
    Wall1.render(size);
    Wall2.render(size);
    Wall3.render(size);
    Wall4.render(size);
    Funnel.render(size);
    Funnel2.render(size);
    renderMain(te);
    GL11.glPopMatrix();
    if (te != null) {
        PneumaticCraftUtils.rotateMatrixByMetadata(te.getBlockMetadata());
    } else {
        PneumaticCraftUtils.rotateMatrixByMetadata(ForgeDirection.DOWN.ordinal());
    }
    InserterBottom.render(size);
    renderBottom(te);
    GL11.glDisable(GL11.GL_BLEND);
}
Also used : TileEntityOmnidirectionalHopper(pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper)

Example 2 with TileEntityOmnidirectionalHopper

use of pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper in project PneumaticCraft by MineMaarten.

the class BlockOmnidirectionalHopper method rotateBlock.

@Override
public boolean rotateBlock(World world, EntityPlayer player, int x, int y, int z, ForgeDirection face) {
    TileEntity te = world.getTileEntity(x, y, z);
    if (te instanceof TileEntityOmnidirectionalHopper) {
        TileEntityOmnidirectionalHopper teOh = (TileEntityOmnidirectionalHopper) te;
        if (player != null && player.isSneaking()) {
            int newMeta = (world.getBlockMetadata(x, y, z) + 1) % 6;
            if (newMeta == teOh.getDirection().ordinal())
                newMeta = (newMeta + 1) % 6;
            world.setBlockMetadataWithNotify(x, y, z, newMeta, 3);
        } else {
            int newRotation = (teOh.getDirection().ordinal() + 1) % 6;
            if (newRotation == world.getBlockMetadata(x, y, z))
                newRotation = (newRotation + 1) % 6;
            teOh.setDirection(ForgeDirection.getOrientation(newRotation));
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityOmnidirectionalHopper(pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper)

Example 3 with TileEntityOmnidirectionalHopper

use of pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper in project PneumaticCraft by MineMaarten.

the class BlockOmnidirectionalHopper method collisionRayTrace.

@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
    TileEntity te = world.getTileEntity(x, y, z);
    if (te instanceof TileEntityOmnidirectionalHopper) {
        ForgeDirection o = ((TileEntityOmnidirectionalHopper) te).getDirection();
        boolean isColliding = false;
        setBlockBounds(o.offsetX == 1 ? 10 / 16F : 0, o.offsetY == 1 ? 10 / 16F : 0, o.offsetZ == 1 ? 10 / 16F : 0, o.offsetX == -1 ? 6 / 16F : 1, o.offsetY == -1 ? 6 / 16F : 1, o.offsetZ == -1 ? 6 / 16F : 1);
        if (super.collisionRayTrace(world, x, y, z, origin, direction) != null)
            isColliding = true;
        setBlockBounds(4 / 16F, 4 / 16F, 4 / 16F, 12 / 16F, 12 / 16F, 12 / 16F);
        if (super.collisionRayTrace(world, x, y, z, origin, direction) != null)
            isColliding = true;
        setBlockBounds(0, 0, 0, 1, 1, 1);
        return isColliding ? super.collisionRayTrace(world, x, y, z, origin, direction) : null;
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityOmnidirectionalHopper(pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper) ForgeDirection(net.minecraftforge.common.util.ForgeDirection)

Aggregations

TileEntityOmnidirectionalHopper (pneumaticCraft.common.tileentity.TileEntityOmnidirectionalHopper)3 TileEntity (net.minecraft.tileentity.TileEntity)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1