MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / matchesProperties

Method matchesProperties

src/main/java/net/optifine/CustomItems.java:695–810  ·  view source on GitHub ↗
(CustomItemProperties cip, ItemStack itemStack, int[][] enchantmentIdLevels)

Source from the content-addressed store, hash-verified

693 }
694
695 private static boolean matchesProperties(CustomItemProperties cip, ItemStack itemStack, int[][] enchantmentIdLevels)
696 {
697 Item item = itemStack.getItem();
698
699 if (cip.damage != null)
700 {
701 int i = itemStack.getItemDamage();
702
703 if (cip.damageMask != 0)
704 {
705 i &= cip.damageMask;
706 }
707
708 if (cip.damagePercent)
709 {
710 int j = item.getMaxDamage();
711 i = (int)((double)(i * 100) / (double)j);
712 }
713
714 if (!cip.damage.isInRange(i))
715 {
716 return false;
717 }
718 }
719
720 if (cip.stackSize != null && !cip.stackSize.isInRange(itemStack.stackSize))
721 {
722 return false;
723 }
724 else
725 {
726 int[][] aint = enchantmentIdLevels;
727
728 if (cip.enchantmentIds != null)
729 {
730 if (enchantmentIdLevels == null)
731 {
732 aint = getEnchantmentIdLevels(itemStack);
733 }
734
735 boolean flag = false;
736
737 for (int k = 0; k < aint.length; ++k)
738 {
739 int l = aint[k][0];
740
741 if (cip.enchantmentIds.isInRange(l))
742 {
743 flag = true;
744 break;
745 }
746 }
747
748 if (!flag)
749 {
750 return false;
751 }
752 }

Callers 3

renderCustomEffectMethod · 0.95

Calls 7

getMaxDamageMethod · 0.95
matchesMethod · 0.95
getItemDamageMethod · 0.80
getItemMethod · 0.45
isInRangeMethod · 0.45
getTagCompoundMethod · 0.45

Tested by

no test coverage detected