use of riskyken.armourersWorkshop.common.skin.data.SkinPointer 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);
}
}
}
}
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class AbstractModItemArmour method getArmorModel.
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack stack, int armorSlot) {
if (!SkinNBTHelper.stackHasSkinData(stack)) {
return null;
}
SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(stack);
AbstractModelSkin targetModel = null;
SkinModelRenderer emr = SkinModelRenderer.INSTANCE;
Skin data = emr.getCustomArmourItemData(skinData);
if (data == null) {
return null;
}
targetModel = emr.getModelForEquipmentType(data.getSkinType());
if (targetModel == null) {
return null;
}
targetModel.npcSkinData = data;
targetModel.npcDyeData = skinData.getSkinDye();
return targetModel;
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer 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;
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeSkinCopy method getCraftingResult.
@Override
public ItemStack getCraftingResult(IInventory inventory) {
ItemStack skinStack = null;
ItemStack blackStack = null;
for (int slotId = 0; slotId < inventory.getSizeInventory(); slotId++) {
ItemStack stack = inventory.getStackInSlot(slotId);
if (stack != null) {
Item item = stack.getItem();
if (item == ModItems.equipmentSkin && SkinNBTHelper.stackHasSkinData(stack)) {
if (skinStack != null) {
return null;
}
skinStack = stack;
} else if (item == ModItems.equipmentSkinTemplate & !SkinNBTHelper.stackHasSkinData(stack)) {
if (blackStack != null) {
return null;
}
blackStack = stack;
} else {
return null;
}
}
}
if (skinStack != null && blackStack != null) {
ItemStack returnStack = new ItemStack(ModItems.equipmentSkin, 1);
SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(skinStack);
SkinNBTHelper.addSkinDataToStack(returnStack, skinData.getIdentifier(), false, new SkinDye(skinData.getSkinDye()));
return returnStack;
}
return null;
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeSkinPickaxe 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.PICKAXE, 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;
}
}
Aggregations