tutorial:armor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:armor [2020/06/17 20:19] – Some corrections in spacing and pack format (5 for 1.15 & 1.16) terantai | tutorial:armor [2020/08/01 00:59] – Add in Knockback Resistance ggtylerr | ||
---|---|---|---|
Line 28: | Line 28: | ||
- Toughness. This is a second protection value where the armor is more durable against high value attacks. | - Toughness. This is a second protection value where the armor is more durable against high value attacks. | ||
- A repair ingredient. This will be a '' | - A repair ingredient. This will be a '' | ||
+ | |||
+ | If you're on 1.16+, they also have a new argument: | ||
+ | - Knockback Resistance. This is the scale of the amount of knockback resisted from attacks, explosions, and projectiles. 1.0 is 100%. | ||
With those arguments, it should now look something like this: | With those arguments, it should now look something like this: | ||
Line 33: | Line 36: | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
public enum CustomArmorMaterial implements ArmorMaterial { | public enum CustomArmorMaterial implements ArmorMaterial { | ||
- | CustomArmorMaterial(String name, int durabilityMultiplier, | + | CustomArmorMaterial(String name, int durabilityMultiplier, |
| | ||
} | } | ||
Line 49: | Line 52: | ||
private final SoundEvent equipSound; | private final SoundEvent equipSound; | ||
private final float toughness; | private final float toughness; | ||
+ | private final float knockbackResistance; | ||
private final Lazy< | private final Lazy< | ||
| | ||
- | CustomArmorMaterial(String name, int durabilityMultiplier, | + | CustomArmorMaterial(String name, int durabilityMultiplier, |
this.name = name; | this.name = name; | ||
this.durabilityMultiplier = durabilityMultiplier; | this.durabilityMultiplier = durabilityMultiplier; | ||
Line 58: | Line 62: | ||
this.equipSound = soundEvent; | this.equipSound = soundEvent; | ||
this.toughness = toughness; | this.toughness = toughness; | ||
+ | this.knockbackResistance = knockbackResistance; | ||
this.repairIngredient = new Lazy(repairIngredient); | this.repairIngredient = new Lazy(repairIngredient); | ||
} | } | ||
Line 76: | Line 81: | ||
private final SoundEvent equipSound; | private final SoundEvent equipSound; | ||
private final float toughness; | private final float toughness; | ||
+ | private final float knockbackResistance; | ||
private final Lazy< | private final Lazy< | ||
| | ||
- | CustomArmorMaterial(String name, int durabilityMultiplier, | + | CustomArmorMaterial(String name, int durabilityMultiplier, |
this.name = name; | this.name = name; | ||
this.durabilityMultiplier = durabilityMultiplier; | this.durabilityMultiplier = durabilityMultiplier; | ||
Line 116: | Line 122: | ||
public float getToughness() { | public float getToughness() { | ||
return this.toughness; | return this.toughness; | ||
+ | } | ||
+ | | ||
+ | public float getKnockbackResistance() { | ||
+ | return this.knockbackResistance; | ||
} | } | ||
} | } | ||
Line 124: | Line 134: | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
public enum CustomArmorMaterial implements ArmorMaterial { | public enum CustomArmorMaterial implements ArmorMaterial { | ||
- | WOOL(" | + | WOOL(" |
return Ingredient.ofItems(Items.WHITE_WOOL); | return Ingredient.ofItems(Items.WHITE_WOOL); | ||
}); | }); |
tutorial/armor.txt · Last modified: 2023/08/20 10:19 by wjz_p