Search in sources :

Example 31 with ISkinType

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

the class ContainerMannequin method transferStackInSlot.

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotId) {
    Slot slot = getSlot(slotId);
    if (slot != null && slot.getHasStack()) {
        ItemStack stack = slot.getStack();
        ItemStack result = stack.copy();
        if (slotId > 35) {
            // Moving from mannequin to player.
            if (!this.mergeItemStack(stack, 9, 36, false)) {
                if (!this.mergeItemStack(stack, 0, 9, false)) {
                    return null;
                }
            }
        } else {
            // Moving from player to mannequin.
            boolean slotted = false;
            for (int i = 0; i < TileEntityMannequin.INVENTORY_SIZE; i++) {
                int targetSlotId = i + 36;
                Slot targetSlot = getSlot(targetSlotId);
                boolean handSlot = false;
                if (i % 7 == 4) {
                    handSlot = true;
                }
                if (i % 7 == 5) {
                    handSlot = true;
                }
                ISkinType skinType = SkinNBTHelper.getSkinTypeFromStack(stack);
                if (skinType != null && skinType.getVanillaArmourSlotId() != -1 | skinType == SkinTypeRegistry.skinWings) {
                    if (!handSlot) {
                        if (targetSlot.isItemValid(stack)) {
                            if (this.mergeItemStack(stack, targetSlotId, targetSlotId + 1, false)) {
                                slotted = true;
                                break;
                            }
                        }
                    }
                } else {
                    if (targetSlot.isItemValid(stack)) {
                        if (this.mergeItemStack(stack, targetSlotId, targetSlotId + 1, false)) {
                            slotted = true;
                            break;
                        }
                    }
                }
            }
            if (!slotted) {
                return null;
            }
        }
        if (stack.stackSize == 0) {
            slot.putStack(null);
        } else {
            slot.onSlotChanged();
        }
        slot.onPickupFromSlot(player, stack);
        return result;
    }
    return null;
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) Slot(net.minecraft.inventory.Slot) ItemStack(net.minecraft.item.ItemStack)

Example 32 with ISkinType

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType 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)

Example 33 with ISkinType

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

the class CommandSetUnlockedWardrobeSlots method processCommand.

@Override
public void processCommand(ICommandSender commandSender, String[] currentCommand) {
    if (currentCommand.length != 4) {
        throw new WrongUsageException(getCommandUsage(commandSender), (Object) currentCommand);
    }
    String playerName = currentCommand[1];
    EntityPlayerMP player = getPlayer(commandSender, playerName);
    if (player == null) {
        return;
    }
    String skinTypeName = currentCommand[2];
    if (StringUtils.isNullOrEmpty(skinTypeName)) {
        throw new WrongUsageException(getCommandUsage(commandSender), (Object) currentCommand);
    }
    int count = 3;
    count = parseIntBounded(commandSender, currentCommand[3], 1, 8);
    ISkinType skinType = SkinTypeRegistry.INSTANCE.getSkinTypeFromRegistryName(skinTypeName);
    if (skinType == null) {
        throw new WrongUsageException(getCommandUsage(commandSender), (Object) currentCommand);
    }
    ExPropsPlayerSkinData.get(player).setSkinColumnCount(skinType, count);
}
Also used : WrongUsageException(net.minecraft.command.WrongUsageException) ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Example 34 with ISkinType

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

the class WardrobeInventoryContainer method writeToNBT.

public void writeToNBT(NBTTagCompound compound) {
    NBTTagCompound containerCompound = new NBTTagCompound();
    Set skinTypes = skinInventorys.keySet();
    for (int i = 0; i < skinInventorys.size(); i++) {
        ISkinType skinType = (ISkinType) skinInventorys.keySet().toArray()[i];
        skinInventorys.get(skinType).writeItemsToNBT(containerCompound);
    }
    compound.setTag(TAG_WARDROBE_CONTAINER, containerCompound);
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) Set(java.util.Set) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 35 with ISkinType

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

the class WardrobeInventoryContainer method dropItems.

public void dropItems(EntityPlayer player) {
    Set skinTypes = skinInventorys.keySet();
    for (int i = 0; i < skinInventorys.size(); i++) {
        ISkinType skinType = (ISkinType) skinInventorys.keySet().toArray()[i];
        skinInventorys.get(skinType).dropItems(player);
    }
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) Set(java.util.Set)

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