use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeSkinSword method getCraftingResult.
@Override
public ItemStack getCraftingResult(IInventory inventory) {
ItemStack skinStack = null;
ItemStack swordStack = null;
for (int slotId = 0; slotId < inventory.getSizeInventory(); slotId++) {
ItemStack stack = inventory.getStackInSlot(slotId);
if (stack != null) {
Item item = stack.getItem();
if (isValidSkinForType(stack)) {
if (skinStack != null) {
return null;
}
skinStack = stack;
} else if (EntityEquipmentDataManager.INSTANCE.isRenderItem(ItemOverrideType.SWORD, item) & !SkinNBTHelper.isSkinLockedOnStack(stack)) {
if (swordStack != null) {
return null;
}
swordStack = stack;
} else {
return null;
}
}
}
if (skinStack != null && swordStack != null) {
ItemStack returnStack = swordStack.copy();
SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(skinStack);
SkinNBTHelper.addSkinDataToStack(returnStack, skinData.getIdentifier(), skinData.getSkinDye(), true);
return returnStack;
} else {
return null;
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class SlotDyeableSkin method onSlotChanged.
@Override
public void onSlotChanged() {
ItemStack stack = getStack();
if (stack == null) {
container.skinRemoved();
} else {
SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(stack);
if (sp != null) {
if (stack.getItem() == ModItems.equipmentSkin) {
container.skinAdded(stack);
} else {
if (sp.lockSkin) {
container.skinAdded(stack);
}
}
}
}
super.onSlotChanged();
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class EntityEquipmentData method toBytes.
private void toBytes(ByteBuf buf) {
buf.writeByte(skinPointerMap.size());
for (int i = 0; i < skinPointerMap.size(); i++) {
String skinName = (String) skinPointerMap.keySet().toArray()[i];
NBTTagCompound compound = new NBTTagCompound();
SkinPointer skinPointer = (SkinPointer) skinPointerMap.get(skinName);
skinPointer.writeToCompound(compound);
ByteBufUtils.writeTag(buf, compound);
ByteBufUtils.writeUTF8String(buf, skinName);
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class ExPropsPlayerSkinData method loadFromItemStack.
private void loadFromItemStack(ItemStack stack, byte slotId) {
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
addCustomEquipment(skinPointer.getIdentifier().getSkinType(), slotId, skinPointer);
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class SkinNBTHelper method getSkinPointerFromStack.
public static SkinPointer getSkinPointerFromStack(ItemStack stack) {
if (!stackHasSkinData(stack)) {
return null;
}
SkinPointer skinData = new SkinPointer();
skinData.readFromCompound(stack.getTagCompound());
return skinData;
}
Aggregations