|
1 | 1 | --- before/net/minecraft/item/ItemArmor.java |
2 | 2 | +++ after/net/minecraft/item/ItemArmor.java |
3 | | -@@ -21,6 +21,7 @@ |
4 | | - import net.minecraft.util.ActionResult; |
5 | | - import net.minecraft.util.EntitySelectors; |
6 | | - import net.minecraft.util.EnumActionResult; |
7 | | -+import net.minecraft.util.EnumFacing; |
8 | | - import net.minecraft.util.EnumHand; |
9 | | - import net.minecraft.util.SoundEvent; |
10 | | - import net.minecraft.util.math.AxisAlignedBB; |
11 | | -@@ -32,23 +33,10 @@ |
12 | | - public class ItemArmor extends Item |
13 | | - { |
14 | | - private static final int[] MAX_DAMAGE_ARRAY = new int[] {13, 15, 16, 11}; |
15 | | -- private static final UUID[] ARMOR_MODIFIERS = new UUID[] |
16 | | -- { |
17 | | -- UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), |
18 | | -- UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), |
19 | | -- UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), |
20 | | -- UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150") |
21 | | -- }; |
22 | | -- public static final String[] EMPTY_SLOT_NAMES = new String[] |
23 | | -- { |
24 | | -- "minecraft:items/empty_armor_slot_boots", |
25 | | -- "minecraft:items/empty_armor_slot_leggings", |
26 | | -- "minecraft:items/empty_armor_slot_chestplate", |
27 | | -- "minecraft:items/empty_armor_slot_helmet" |
28 | | -- }; |
29 | | -+ private static final UUID[] ARMOR_MODIFIERS = new UUID[] {UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")}; |
30 | | -+ public static final String[] EMPTY_SLOT_NAMES = new String[] {"minecraft:items/empty_armor_slot_boots", "minecraft:items/empty_armor_slot_leggings", "minecraft:items/empty_armor_slot_chestplate", "minecraft:items/empty_armor_slot_helmet"}; |
31 | | - public static final IBehaviorDispenseItem DISPENSER_BEHAVIOR = new BehaviorDefaultDispenseItem() |
32 | | - { |
33 | | -- @Override |
34 | | - protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) |
35 | | - { |
36 | | - ItemStack itemstack = ItemArmor.dispenseArmor(source, stack); |
37 | | -@@ -63,11 +51,8 @@ |
38 | | - |
39 | | - public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack) |
40 | | - { |
41 | | -- BlockPos blockpos = blockSource.getBlockPos().offset(blockSource.getBlockState().getValue(BlockDispenser.FACING)); |
42 | | -- List<EntityLivingBase> list = blockSource.getWorld() |
43 | | -- .getEntitiesWithinAABB( |
44 | | -- EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)) |
45 | | -- ); |
46 | | -+ BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING)); |
47 | | -+ List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack))); |
48 | | - |
49 | | - if (list.isEmpty()) |
50 | | - { |
51 | | -@@ -108,7 +93,6 @@ |
52 | | - return this.armorType; |
53 | | - } |
54 | | - |
55 | | -- @Override |
56 | | - public int getItemEnchantability() |
57 | | - { |
58 | | - return this.material.getEnchantability(); |
59 | | -@@ -128,9 +112,7 @@ |
60 | | - else |
61 | | - { |
62 | | - NBTTagCompound nbttagcompound = stack.getTagCompound(); |
63 | | -- return nbttagcompound != null && nbttagcompound.hasKey("display", 10) |
64 | | -- ? nbttagcompound.getCompoundTag("display").hasKey("color", 3) |
65 | | -- : false; |
66 | | -+ return nbttagcompound != null && nbttagcompound.hasKey("display", 10) ? nbttagcompound.getCompoundTag("display").hasKey("color", 3) : false; |
67 | | - } |
68 | | - } |
69 | | - |
70 | | -@@ -203,13 +185,13 @@ |
71 | | - } |
72 | | - } |
73 | | - |
74 | | -- @Override |
| 3 | +@@ -206,7 +206,9 @@ |
| 4 | + @Override |
75 | 5 | public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) |
76 | 6 | { |
77 | 7 | - return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); |
|
80 | 10 | + return super.getIsRepairable(toRepair, repair); |
81 | 11 | } |
82 | 12 |
|
83 | | -- @Override |
84 | | - public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) |
85 | | - { |
86 | | - ItemStack itemstack = playerIn.getHeldItem(handIn); |
87 | | -@@ -220,34 +202,40 @@ |
88 | | - { |
89 | | - playerIn.setItemStackToSlot(entityequipmentslot, itemstack.copy()); |
90 | | - itemstack.setCount(0); |
91 | | -- return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); |
92 | | -+ return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); |
93 | | - } |
94 | | - else |
95 | | - { |
96 | | -- return new ActionResult<>(EnumActionResult.FAIL, itemstack); |
97 | | -+ return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemstack); |
98 | | - } |
99 | | - } |
100 | | - |
101 | | -- @Override |
102 | | - public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) |
103 | | - { |
104 | | - Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot); |
105 | | - |
106 | | - if (equipmentSlot == this.armorType) |
107 | | - { |
108 | | -- multimap.put( |
109 | | -- SharedMonsterAttributes.ARMOR.getName(), |
110 | | -- new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", this.damageReduceAmount, 0) |
111 | | -- ); |
112 | | -- multimap.put( |
113 | | -- SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), |
114 | | -- new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", this.toughness, 0) |
115 | | -- ); |
116 | | -+ multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor modifier", (double)this.damageReduceAmount, 0)); |
117 | | -+ multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS[equipmentSlot.getIndex()], "Armor toughness", (double)this.toughness, 0)); |
118 | | - } |
119 | | - |
| 13 | + @Override |
| 14 | +@@ -248,6 +250,19 @@ |
120 | 15 | return multimap; |
121 | 16 | } |
122 | 17 |
|
|
136 | 31 | public static enum ArmorMaterial |
137 | 32 | { |
138 | 33 | LEATHER("leather", 5, new int[]{1, 2, 3, 1}, 15, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0.0F), |
139 | | -@@ -262,6 +250,8 @@ |
| 34 | +@@ -262,6 +277,8 @@ |
140 | 35 | private final int enchantability; |
141 | 36 | private final SoundEvent soundEvent; |
142 | 37 | private final float toughness; |
|
145 | 40 |
|
146 | 41 | private ArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountArrayIn, int enchantabilityIn, SoundEvent soundEventIn, float toughnessIn) |
147 | 42 | { |
148 | | -@@ -293,6 +283,7 @@ |
| 43 | +@@ -293,6 +310,7 @@ |
149 | 44 | return this.soundEvent; |
150 | 45 | } |
151 | 46 |
|
152 | 47 | + @Deprecated // Use getRepairItemStack below |
153 | 48 | public Item getRepairItem() |
154 | 49 | { |
155 | 50 | if (this == LEATHER) |
156 | | -@@ -326,6 +317,22 @@ |
| 51 | +@@ -326,6 +344,22 @@ |
157 | 52 | public float getToughness() |
158 | 53 | { |
159 | 54 | return this.toughness; |
|
0 commit comments