@Override public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag advancedToolTip) { super.addInformation(itemStack, player, list, advancedToolTip); list.add("Every piece of the radiation suit"); list.add("adds a bit of protection for radiation"); }
public int getColorFromItemstack(@Nonnull ItemStack stack, int tintIndex) { return tintIndex > 0 ? -1 : ((ItemArmor) stack.getItem()).getColor(stack); } }, burlapHelmet, burlapChestplate, burlapLeggings, burlapBoots);
@Nullable @Override public ItemStack getExample() { ItemStack stack = new ItemStack(Items.LEATHER_CHESTPLATE); Items.LEATHER_CHESTPLATE.setColor(stack, 0xFF0000); return stack; } }
armour = (ItemArmor) craftStack.getItem(); result = craftStack.copy(); if (armour.hasColor(craftStack)) { colour = armour.getColor(result); f = (colour >> 16 & 255) / 255.0F; f1 = (colour >> 8 & 255) / 255.0F; if (armour.hasColor(craftStack)) { colour = armour.getColor(result); f = (colour >> 16 & 255) / 255.0F; f1 = (colour >> 8 & 255) / 255.0F; i1 = (k << 8) + l1; i1 = (i1 << 8) + colour; armour.setColor(result, i1); return result;
private boolean isIronMaterial(ItemStack itemStack) { if (itemStack != null && itemStack.getItem() instanceof ItemArmor) { String materialName = ((ItemArmor) itemStack.getItem()).getArmorMaterial().getName(); return materialName.matches("(?i)(iron|chainmail|tritanium)"); } return false; }
if (itemarmor.getEquipmentSlot() == slotIn) if (itemarmor.hasOverlay(itemstack)) // Allow this for anything, not only cloth int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F;
EntityLivingBase living = (EntityLivingBase) entity; ItemStack chestplate = living.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (!chestplate.isEmpty() && chestplate.getItem() == ModItems.GLIDER_CHESTPLATE_POWERED && ModItems.GLIDER_CHESTPLATE_POWERED.hasColor(chestplate)) { int colour = ModItems.GLIDER_CHESTPLATE_POWERED.getColor(chestplate); float red = (colour >> 16 & 255) / 255.0F; float green = (colour >> 8 & 255) / 255.0F;
@Override public boolean getIsRepairable(ItemStack par1ItemStack, @Nonnull ItemStack par2ItemStack) { return par2ItemStack.getItem() == ModItems.manaResource && par2ItemStack.getItemDamage() == 0 ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); }
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { super.onArmorTick(world, player, stack); onUpdate(stack, new TinySlot.InventorySlot(stack, player.inventory), player, true); }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (world.isRemote) return ActionResult.newResult(EnumActionResult.FAIL, stack); RayTraceResult position = this.rayTrace(world, player, false); if (position == null) { return super.onItemRightClick(world, player, EnumHand.MAIN_HAND); } else { if (position.typeOfHit == RayTraceResult.Type.BLOCK) { TileEntity tile = world.getTileEntity(position.getBlockPos()); if (!(tile instanceof IBloodAltar)) return super.onItemRightClick(world, player, EnumHand.MAIN_HAND); LPContainer.tryAndFillAltar((IBloodAltar) tile, stack, world, position.getBlockPos()); } } return ActionResult.newResult(EnumActionResult.FAIL, stack); }
EntityEquipmentSlot slot = armor.getEquipmentSlot();
private static int armorSlotAndToughnessCompare(ItemStack stack1, ItemStack stack2) { ItemArmor armor1 = (ItemArmor) stack1.getItem(); ItemArmor armor2 = (ItemArmor) stack2.getItem(); EntityEquipmentSlot slot1 = armor1.armorType; EntityEquipmentSlot slot2 = armor2.armorType; if(slot1 == slot2) return armor2.getArmorMaterial().getDamageReductionAmount(slot2) - armor2.getArmorMaterial().getDamageReductionAmount(slot1); return slot2.getIndex() - slot1.getIndex(); }
@Override public boolean getIsRepairable(ItemStack toRepair, @Nullable ItemStack repair) { if (repairMaterial instanceof ItemStack && repair != null) { return repair.isItemEqual((ItemStack) repairMaterial) || super.getIsRepairable(toRepair, repair); } if (repairMaterial instanceof String) { return ItemStackUtility.isItemOreDictedAs(repair, (String) repairMaterial) || super.getIsRepairable(toRepair, repair); } return super.getIsRepairable(toRepair, repair); } }
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { super.onArmorTick(world, player, itemStack); if (player.ticksExisted % 16 == 8) { if (Helper.isVampire(player)) { player.addPotionEffect(new PotionEffect(MobEffects.POISON, 20, 1)); } } }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (world.isRemote) return ActionResult.newResult(EnumActionResult.FAIL, stack); RayTraceResult rayTrace = this.rayTrace(world, player, false); if (rayTrace == null) { return super.onItemRightClick(world, player, EnumHand.MAIN_HAND); } else { if (rayTrace.typeOfHit == RayTraceResult.Type.BLOCK) { TileEntity tile = world.getTileEntity(rayTrace.getBlockPos()); if (!(tile instanceof IBloodAltar)) return super.onItemRightClick(world, player, EnumHand.MAIN_HAND); LPContainer.tryAndFillAltar((IBloodAltar) tile, stack, world, rayTrace.getBlockPos()); } } return ActionResult.newResult(EnumActionResult.FAIL, stack); }
} else if (!(item instanceof ItemArmor) || ((ItemArmor) item).getEquipmentSlot() != EntityEquipmentSlot.HEAD) { GlStateManager.translate(0, 0.5f, 0); GlStateManager.rotate(-(mimic.prevRotationYawHead + partialTicks * (mimic.rotationYawHead - mimic.prevRotationYawHead)) - 180, 0, 1, 0);
@Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack armor, EntityPlayer player, List<String> par3List, boolean par4) { super.addInformation(armor, player, par3List, par4); par3List.add(String.format("%s +%d %s", TextFormatting.BLUE, this.damageReduceAmount, I18n.format("tooltip.armour.points"))); par3List.add(TextFormatting.RED + I18n.format("attribute.modifier.take." + 2, ItemStack.DECIMALFORMAT.format(-motionFactor*100.0D), I18n.format("attribute.name.generic.movementSpeed"))); }
private static String getName(@Nonnull ItemStack stack) { Item item = stack.getItem(); if (item instanceof ItemTool) { return ((ItemTool) item).getToolMaterialName(); } else if (item instanceof ItemSword) { return ((ItemSword) item).getToolMaterialName(); } else if (item instanceof ItemArmor) { return ((ItemArmor) item).getArmorMaterial().toString(); } else { return null; } }
@Override public IItemColor getItemColor() { return (stack, i) -> i == 1 ? ((ItemArmor) stack.getItem()).getColor(stack) : -1; }
public static ItemStack getWoolyArmor(Item item, java.lang.String name) { ItemStack stack = new ItemStack(item); stack.setStackDisplayName(name); ((ItemArmor)item).setColor(stack, 0xFFFFFF); return stack; }