Search in sources :

Example 11 with IPoint3D

use of riskyken.armourersWorkshop.api.common.IPoint3D in project Armourers-Workshop by RiskyKen.

the class ArmourerWorldHelper method loadSkinPartIntoWorld.

private static void loadSkinPartIntoWorld(World world, SkinPart partData, int xCoord, int yCoord, int zCoord, ForgeDirection direction, boolean mirror) {
    ISkinPartType skinPart = partData.getPartType();
    IRectangle3D buildSpace = skinPart.getBuildingSpace();
    IPoint3D offset = skinPart.getOffset();
    SkinCubeData cubeData = partData.getCubeData();
    for (int i = 0; i < cubeData.getCubeCount(); i++) {
        ICube blockData = cubeData.getCube(i);
        int meta = 0;
        for (int j = 0; j < partData.getMarkerBlocks().size(); j++) {
            CubeMarkerData cmd = partData.getMarkerBlocks().get(j);
            byte[] loc = cubeData.getCubeLocation(i);
            if (cmd.x == loc[0] & cmd.y == loc[1] & cmd.z == loc[2]) {
                meta = cmd.meta;
                break;
            }
        }
        int xOrigin = -offset.getX();
        int yOrigin = -offset.getY() + -buildSpace.getY();
        int zOrigin = offset.getZ();
        loadSkinBlockIntoWorld(world, xCoord, yCoord, zCoord, xOrigin, yOrigin, zOrigin, blockData, direction, meta, cubeData, i, mirror);
    }
}
Also used : ISkinPartType(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType) SkinCubeData(riskyken.armourersWorkshop.common.skin.data.SkinCubeData) IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D) IRectangle3D(riskyken.armourersWorkshop.api.common.IRectangle3D) CubeMarkerData(riskyken.armourersWorkshop.common.skin.cubes.CubeMarkerData) ICube(riskyken.armourersWorkshop.common.skin.cubes.ICube)

Example 12 with IPoint3D

use of riskyken.armourersWorkshop.api.common.IPoint3D in project Armourers-Workshop by RiskyKen.

the class SkinItemRenderHelper method renderSkinWithoutHelper.

public static void renderSkinWithoutHelper(ISkinPointer skinPointer, boolean doLodLoading) {
    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
    if (skin == null) {
        return;
    }
    float scale = 1F / 16F;
    for (int i = 0; i < skin.getParts().size(); i++) {
        GL11.glPushMatrix();
        SkinPart skinPart = skin.getParts().get(i);
        IPoint3D offset = skinPart.getPartType().getOffset();
        GL11.glTranslated(offset.getX() * scale, (offset.getY() + 1) * scale, offset.getZ() * scale);
        SkinPartRenderer.INSTANCE.renderPart(skinPart, 0.0625F, skinPointer.getSkinDye(), null, doLodLoading);
        GL11.glPopMatrix();
    }
}
Also used : IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

Example 13 with IPoint3D

use of riskyken.armourersWorkshop.api.common.IPoint3D in project Armourers-Workshop by RiskyKen.

the class SkinRenderHelper method renderBuildingGrid.

public static void renderBuildingGrid(ISkinType skinType, float scale, boolean showGuides, boolean hidden, boolean multiblock) {
    for (int i = 0; i < skinType.getSkinParts().size(); i++) {
        ISkinPartType skinPartType = skinType.getSkinParts().get(i);
        IPoint3D partOffset = skinPartType.getOffset();
        GL11.glTranslated(partOffset.getX() * scale, partOffset.getY() * scale, partOffset.getZ() * scale);
        if (skinType == SkinTypeRegistry.skinBlock) {
            if (skinPartType.getPartName().equals("multiblock") & multiblock) {
                GL11.glColor4f(1F, 1F, 0.0F, 0.2F);
                renderBuildingGrid(((SkinBlock) SkinTypeRegistry.skinBlock).partBase, scale, showGuides, hidden);
                GL11.glPolygonOffset(6F, 6F);
                GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.25F);
                renderBuildingGrid(skinPartType, scale, showGuides, hidden);
            } else if (skinPartType.getPartName().equals("base") & !multiblock) {
                GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.25F);
                renderBuildingGrid(skinPartType, scale, showGuides, hidden);
            }
        } else {
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 0.25F);
            renderBuildingGrid(skinPartType, scale, showGuides, hidden);
        }
        GL11.glTranslated(-partOffset.getX() * scale, -partOffset.getY() * scale, -partOffset.getZ() * scale);
    }
}
Also used : ISkinPartType(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType) IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D)

Example 14 with IPoint3D

use of riskyken.armourersWorkshop.api.common.IPoint3D in project Armourers-Workshop by RiskyKen.

the class SkinRenderHelper method renderBuildingGuide.

public static void renderBuildingGuide(ISkinType skinType, float scale, boolean showSkinOverlay, boolean showHelper) {
    for (int i = 0; i < skinType.getSkinParts().size(); i++) {
        ISkinPartType skinPart = skinType.getSkinParts().get(i);
        IPoint3D partOffset = skinPart.getOffset();
        GL11.glTranslated(partOffset.getX() * scale, partOffset.getY() * scale, partOffset.getZ() * scale);
        skinPart.renderBuildingGuide(scale, showSkinOverlay, showHelper);
        GL11.glTranslated(-partOffset.getX() * scale, -partOffset.getY() * scale, -partOffset.getZ() * scale);
    }
}
Also used : ISkinPartType(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType) IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D)

Example 15 with IPoint3D

use of riskyken.armourersWorkshop.api.common.IPoint3D in project Armourers-Workshop by RiskyKen.

the class ItemStackRenderHelper method renderSkinWithoutHelper.

public static void renderSkinWithoutHelper(ISkinPointer skinPointer, boolean doLodLoading) {
    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
    if (skin == null) {
        return;
    }
    float scale = 1F / 16F;
    for (int i = 0; i < skin.getParts().size(); i++) {
        GL11.glPushMatrix();
        SkinPart skinPart = skin.getParts().get(i);
        IPoint3D offset = skinPart.getPartType().getOffset();
        GL11.glTranslated(offset.getX() * scale, (offset.getY() + 1) * scale, offset.getZ() * scale);
        SkinPartRenderer.INSTANCE.renderPart(skinPart, 0.0625F, skinPointer.getSkinDye(), null, doLodLoading);
        GL11.glPopMatrix();
    }
}
Also used : IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

Aggregations

IPoint3D (riskyken.armourersWorkshop.api.common.IPoint3D)15 IRectangle3D (riskyken.armourersWorkshop.api.common.IRectangle3D)9 Block (net.minecraft.block.Block)5 ISkinPartType (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType)5 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)5 SkinBlock (riskyken.armourersWorkshop.common.skin.type.block.SkinBlock)5 ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)3 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)3 Point (java.awt.Point)2 ArrayList (java.util.ArrayList)2 CubeMarkerData (riskyken.armourersWorkshop.common.skin.cubes.CubeMarkerData)2 SkinCubeData (riskyken.armourersWorkshop.common.skin.data.SkinCubeData)2 TileEntity (net.minecraft.tileentity.TileEntity)1 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1 Rectangle3D (riskyken.armourersWorkshop.api.common.skin.Rectangle3D)1 BlockLocation (riskyken.armourersWorkshop.common.blocks.BlockLocation)1 SkinSaveException (riskyken.armourersWorkshop.common.exception.SkinSaveException)1 PaintType (riskyken.armourersWorkshop.common.painting.PaintType)1 ICube (riskyken.armourersWorkshop.common.skin.cubes.ICube)1 TileEntityBoundingBox (riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox)1