public int getColorFromItemstack(@Nonnull ItemStack stack, int tintIndex) { return tintIndex > 0 ? -1 : ((ItemArmor) stack.getItem()).getColor(stack); } }, burlapHelmet, burlapChestplate, burlapLeggings, burlapBoots);
@Override public IItemColor getItemColor() { return (stack, i) -> i == 1 ? ((ItemArmor) stack.getItem()).getColor(stack) : -1; }
@Nonnull @Override public Map<Object, Object> getMeta(@Nonnull ItemStack stack) { Item item = stack.getItem(); if (item instanceof ItemArmor) { ItemArmor armor = (ItemArmor) item; HashMap<Object, Object> data = Maps.newHashMap(); data.put("armorType", armor.armorType.getName()); int color = armor.getColor(stack); if (color >= 0) { data.put("color", color); data.put("colour", color); } return data; } else { return Collections.emptyMap(); } }
static void registerColors() { // Swiftness armor Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> { if (tintIndex == 0) { return ((ItemArmor) stack.getItem()).getColor(stack); } else { switch (ModItems.armor_of_swiftness_feet.getTier(stack)) { case ENHANCED: return 0x007CFF; case ULTIMATE: return 0x07F8FF; default: return 0xFFF100; } } }, ModItems.armor_of_swiftness_feet, ModItems.armor_of_swiftness_chest, ModItems.armor_of_swiftness_head, ModItems.armor_of_swiftness_legs); Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> { if (tintIndex == 1) { return ItemCrossbowArrow.getType(stack).color; } return 0xFFFFFF; }, ModItems.crossbow_arrow); }
int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F;
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;