Search in sources :

Example 31 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class BlockSkinnable method addCollisionBoxesToList.

@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list, Entity entity) {
    if (entity instanceof Seat) {
        return;
    }
    if (entity != null && entity instanceof EntityPlayer) {
        if (((EntityPlayer) entity).isPlayerSleeping()) {
            Skin skin = getSkin(world, x, y, z);
            if (skin != null) {
                Point3D point = null;
                if (skin.getParts().get(0).getMarkerCount() > 0) {
                    point = skin.getParts().get(0).getMarker(0);
                } else {
                    point = new Point3D(0, 0, 16);
                }
                float scale = 1F / 16F;
            // list.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 0.5F + -point.getY() * scale, z + 1F));
            // ModLogger.log(-point.getY() * scale);
            } else {
            // list.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 0.5F, z + 1F));
            }
            list.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 0.5F, z + 1F));
            return;
        }
    }
    super.addCollisionBoxesToList(world, x, y, z, mask, list, entity);
}
Also used : Point3D(riskyken.armourersWorkshop.api.common.skin.Point3D) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin)

Example 32 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class BlockSkinnable method isBedFoot.

@Override
public boolean isBedFoot(IBlockAccess world, int x, int y, int z) {
    Skin skin = getSkin(world, x, y, z);
    if (skin != null) {
        for (int i = 0; i < skin.getPartCount(); i++) {
            SkinPart part = skin.getParts().get(i);
            part.getMarkerCount();
        }
    }
    return false;
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

Example 33 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class BlockSkinnable method rotateBlock.

@Override
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) {
    if (world.isRemote) {
        return false;
    }
    Skin skin = getSkin(world, x, y, z);
    if (skin == null) {
        return false;
    }
    if (SkinProperties.PROP_BLOCK_MULTIBLOCK.getValue(skin.getProperties())) {
        return false;
    }
    int rotation = world.getBlockMetadata(x, y, z);
    rotation++;
    if (rotation > 3) {
        rotation = 0;
    }
    world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
    return true;
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin)

Example 34 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class ContainerArmourLibrary method updateSkinName.

@SideOnly(Side.CLIENT)
public void updateSkinName(int slotId) {
    Minecraft mc = Minecraft.getMinecraft();
    GuiScreen screen = mc.currentScreen;
    if (screen != null && screen instanceof GuiSkinLibrary) {
        GuiSkinLibrary libScreen = (GuiSkinLibrary) screen;
        ItemStack stack = getSlot(36).getStack();
        if (stack == null) {
            libScreen.setFileName("");
        } else {
            SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
            if (skinPointer != null) {
                if (ClientSkinCache.INSTANCE.isSkinInCache(skinPointer)) {
                    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
                    String skinName = skin.getCustomName();
                    if (!StringUtils.isNullOrEmpty(skinName)) {
                        libScreen.setFileName(skinName);
                    }
                }
            }
        }
    }
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) GuiScreen(net.minecraft.client.gui.GuiScreen) ItemSkin(riskyken.armourersWorkshop.common.items.ItemSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) GuiSkinLibrary(riskyken.armourersWorkshop.client.gui.skinlibrary.GuiSkinLibrary) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 35 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class ContainerGlobalSkinLibrary method buttonPressed.

@Override
public void buttonPressed(byte buttonId) {
    if (buttonId == 0) {
        if (!tileEntity.getWorldObj().isRemote) {
            if (!getSlot(37).getHasStack()) {
                ItemStack itemStack = getSlot(36).getStack();
                SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(itemStack);
                if (skinPointer != null) {
                    Skin skin = CommonSkinCache.INSTANCE.getSkin(skinPointer);
                    if (skin != null) {
                        onSkinUploaded();
                        MessageServerLibrarySendSkin message = new MessageServerLibrarySendSkin(null, null, skin, SendType.GLOBAL_UPLOAD);
                        PacketHandler.networkWrapper.sendTo(message, (EntityPlayerMP) player);
                    }
                }
            }
        }
    }
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) MessageServerLibrarySendSkin(riskyken.armourersWorkshop.common.network.messages.server.MessageServerLibrarySendSkin) MessageServerLibrarySendSkin(riskyken.armourersWorkshop.common.network.messages.server.MessageServerLibrarySendSkin) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Skin (riskyken.armourersWorkshop.common.skin.data.Skin)69 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)19 ItemStack (net.minecraft.item.ItemStack)11 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)11 LibraryFile (riskyken.armourersWorkshop.common.library.LibraryFile)10 SkinIdentifier (riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)10 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)10 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)9 IOException (java.io.IOException)6 ISkinIdentifier (riskyken.armourersWorkshop.api.common.skin.data.ISkinIdentifier)6 AbstractModelSkin (riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)6 ItemSkin (riskyken.armourersWorkshop.common.items.ItemSkin)6 Color (java.awt.Color)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 DataInputStream (java.io.DataInputStream)4 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)4 BakedSkin (riskyken.armourersWorkshop.client.model.bake.ModelBakery.BakedSkin)4 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 BufferedInputStream (java.io.BufferedInputStream)3 ArrayList (java.util.ArrayList)3