Search in sources :

Example 6 with ISkinPartTypeTextured

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method getPaintType.

@Override
public PaintType getPaintType(IBlockAccess world, int x, int y, int z, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return PaintType.NORMAL;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (parent != null) {
            if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int colour = parent.getPaintData(texturePoint.x, texturePoint.y);
                return PaintType.getPaintTypeFromColour(colour);
            }
        }
    }
    return PaintType.NORMAL;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 7 with ISkinPartTypeTextured

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured in project Armourers-Workshop by RiskyKen.

the class TileEntityBoundingBox method getPaintType.

public PaintType getPaintType(int side) {
    if (isParentValid() && skinPart instanceof ISkinPartTypeTextured) {
        Point texPoint = SkinTextureHelper.getTextureLocationFromWorldBlock(this, side);
        int colour = getParent().getPaintData(texPoint.x, texPoint.y);
        return PaintType.getPaintTypeFromColour(colour);
    } else {
        // ModLogger.log("x" + parentX);
        return PaintType.DYE_1;
    }
}
Also used : ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 8 with ISkinPartTypeTextured

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured in project Armourers-Workshop by RiskyKen.

the class RenderBlockColourable method renderTileEntityAt.

public void renderTileEntityAt(TileEntityBoundingBox tileEntity, double x, double y, double z, float partialTickTime) {
    if (!(tileEntity.getSkinPart() instanceof ISkinPartTypeTextured)) {
        return;
    }
    GL11.glDisable(GL11.GL_LIGHTING);
    ModRenderHelper.enableAlphaBlend();
    renderer.startDrawingQuads();
    renderer.setColourRGBA_F(0.7F, 0.7F, 0.7F, markerAlpha);
    if (markerAlpha > 0F) {
        for (int i = 0; i < 6; i++) {
            if (tileEntity.isPaintableSide(i)) {
                ForgeDirection dir = ForgeDirection.getOrientation(i);
                PaintType paintType = tileEntity.getPaintType(i);
                if (paintType != PaintType.NONE) {
                    bindTexture(MARKERS);
                    GL11.glColor3f(0.77F, 0.77F, 0.77F);
                    renderFaceWithMarker(x, y, z, dir, paintType.ordinal());
                }
            }
        }
    }
    renderer.draw();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    ModRenderHelper.disableAlphaBlend();
    ModRenderHelper.enableLighting();
    RenderHelper.enableStandardItemLighting();
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) PaintType(riskyken.armourersWorkshop.common.painting.PaintType) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)

Example 9 with ISkinPartTypeTextured

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method isRemoteOnly.

@Override
public boolean isRemoteOnly(IBlockAccess world, int x, int y, int z, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return false;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (parent != null) {
            if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int colour = parent.getPaintData(texturePoint.x, texturePoint.y);
                int paintType = BitwiseUtils.getUByteFromInt(colour, 0);
                return paintType == 0;
            }
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 10 with ISkinPartTypeTextured

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method setPaintType.

@Override
public void setPaintType(IBlockAccess world, int x, int y, int z, PaintType paintType, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
            if (parent != null) {
                ISkinType skinType = parent.getSkinType();
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int oldColour = parent.getPaintData(texturePoint.x, texturePoint.y);
                int newColour = PaintType.setPaintTypeOnColour(paintType, oldColour);
                parent.updatePaintData(texturePoint.x, texturePoint.y, newColour);
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Aggregations

ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)10 Point (java.awt.Point)8 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)7 TileEntity (net.minecraft.tileentity.TileEntity)5 TileEntityArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer)5 TileEntityBoundingBox (riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox)5 IPoint3D (riskyken.armourersWorkshop.api.common.IPoint3D)3 ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)2 PaintType (riskyken.armourersWorkshop.common.painting.PaintType)2 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)2 BufferedImage (java.awt.image.BufferedImage)1 ArrayList (java.util.ArrayList)1 IRectangle3D (riskyken.armourersWorkshop.api.common.IRectangle3D)1 Rectangle3D (riskyken.armourersWorkshop.api.common.skin.Rectangle3D)1 ISkinPartType (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType)1 PlayerTexture (riskyken.armourersWorkshop.client.texture.PlayerTexture)1 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)1