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;
}
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);
}
}
}
}
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);
}
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);
}
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);
}
}
Aggregations