Search in sources :

Example 11 with ISkinType

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

the class ExPropsEntityEquipmentData method setInventorySlotContents.

@Override
public void setInventorySlotContents(IInventory inventory, int slotId, ItemStack stack) {
    if (entity.worldObj.isRemote) {
        return;
    }
    if (stack == null) {
        ISkinType skinType = getSkinTypeForSlot(slotId);
        equipmentData.removeEquipment(skinType, 0);
    } else {
        SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(stack);
        equipmentData.addEquipment(skinData.getIdentifier().getSkinType(), 0, skinData);
    }
    sendEquipmentDataToPlayerToAllPlayersAround();
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer)

Example 12 with ISkinType

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

the class RenderBlockMiniArmourer method renderTileEntityAt.

public void renderTileEntityAt(TileEntityMiniArmourer tileEntity, double x, double y, double z, float tickTime) {
    Minecraft mc = Minecraft.getMinecraft();
    mc.mcProfiler.startSection("armourersMiniArmourer");
    float scale = 0.0625F;
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
    GL11.glScalef(-1, -1, 1);
    modelArmourer.render(tileEntity, tickTime, scale);
    GL11.glTranslated(0D, -0.5D, 0D);
    ISkinType skinType = tileEntity.getSkinType();
    if (skinType != null) {
        float rotation = (float) ((double) System.currentTimeMillis() / 25 % 360);
        GL11.glRotatef(rotation, 0F, 1F, 0F);
        bindTexture(Minecraft.getMinecraft().thePlayer.getLocationSkin());
        SkinRenderHelper.renderBuildingGuide(skinType, scale, true, false);
    // skinType.renderBuildingGrid(scale);
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
    mc.mcProfiler.endSection();
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) Minecraft(net.minecraft.client.Minecraft)

Example 13 with ISkinType

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

the class BlockBoundingBox method setColour.

@Override
public boolean setColour(IBlockAccess world, int x, int y, int z, int colour, 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 (((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 paintType = BitwiseUtils.getUByteFromInt(oldColour, 0);
                int newColour = BitwiseUtils.setUByteToInt(colour, 0, paintType);
                parent.updatePaintData(texturePoint.x, texturePoint.y, newColour);
                return true;
            }
        }
    }
    return false;
}
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)

Example 14 with ISkinType

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

the class RecipeSkinArmour method isValidArmourForSkin.

private boolean isValidArmourForSkin(ItemStack armourStack, ItemStack skinStack) {
    SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(skinStack);
    ISkinType skinType = sp.getIdentifier().getSkinType();
    Item armourItem = armourStack.getItem();
    if (armourItem.isValidArmor(armourStack, skinType.getVanillaArmourSlotId(), null)) {
        return true;
    }
    return false;
}
Also used : Item(net.minecraft.item.Item) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType)

Example 15 with ISkinType

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

the class ExPropsPlayerSkinData method clearAllEquipmentStacks.

public void clearAllEquipmentStacks() {
    ArrayList<ISkinType> skinList = SkinTypeRegistry.INSTANCE.getRegisteredSkinTypes();
    for (int i = 0; i < skinList.size(); i++) {
        ISkinType skinType = skinList.get(i);
        WardrobeInventory wi = wardrobeInventoryContainer.getInventoryForSkinType(skinType);
        if (wi != null) {
            for (int j = 0; j < wi.getSizeInventory(); j++) {
                wi.setInventorySlotContents(j, null);
            }
        }
    }
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) TargetPoint(cpw.mods.fml.common.network.NetworkRegistry.TargetPoint) WardrobeInventory(riskyken.armourersWorkshop.common.inventory.WardrobeInventory)

Aggregations

ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)38 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)6 ItemStack (net.minecraft.item.ItemStack)5 SkinIdentifier (riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 GuiButtonExt (cpw.mods.fml.client.config.GuiButtonExt)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Set (java.util.Set)3 Slot (net.minecraft.inventory.Slot)3 Item (net.minecraft.item.Item)3 ILibraryFile (riskyken.armourersWorkshop.api.common.library.ILibraryFile)3 GuiDropDownList (riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList)3 NewerFileVersionException (riskyken.armourersWorkshop.common.exception.NewerFileVersionException)3 Point (java.awt.Point)2 Minecraft (net.minecraft.client.Minecraft)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 ISkinIdentifier (riskyken.armourersWorkshop.api.common.skin.data.ISkinIdentifier)2