Package net.minecraft.item
Record Class ArmorMaterial
java.lang.Object
java.lang.Record
net.minecraft.item.ArmorMaterial
- Record Components:
defense-enchantability-equipSound-repairIngredient-layers-toughness-knockbackResistance-
public record ArmorMaterial(Map<ArmorItem.Type,Integer> defense, int enchantability, RegistryEntry<SoundEvent> equipSound, Supplier<Ingredient> repairIngredient, List<ArmorMaterial.Layer> layers, float toughness, float knockbackResistance)
extends Record
Defines the material stats of an
ArmorItem item.
To view available vanilla armor materials, visit ArmorMaterials.
- Mappings:
Namespace Name named net/minecraft/item/ArmorMaterialintermediary net/minecraft/class_1741official csgnamed defenseintermediary comp_2298official bnamed enchantabilityintermediary comp_2299official cnamed equipSoundintermediary comp_2300official dnamed repairIngredientintermediary comp_2301official enamed layersintermediary comp_2302official fnamed toughnessintermediary comp_2303official gnamed knockbackResistanceintermediary comp_2304official h
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<RegistryEntry<ArmorMaterial>> private final Map<ArmorItem.Type, Integer> The field for thedefenserecord component.private final intThe field for theenchantabilityrecord component.private final RegistryEntry<SoundEvent> The field for theequipSoundrecord component.private final floatThe field for theknockbackResistancerecord component.private final List<ArmorMaterial.Layer> The field for thelayersrecord component.private final Supplier<Ingredient> The field for therepairIngredientrecord component.private final floatThe field for thetoughnessrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionArmorMaterial(Map<ArmorItem.Type, Integer> map, int int2, RegistryEntry<SoundEvent> registryEntry, Supplier<Ingredient> supplier, List<ArmorMaterial.Layer> list, float float2, float float3) -
Method Summary
Modifier and TypeMethodDescriptiondefense()Returns the value of thedefenserecord component.intReturns the value of theenchantabilityrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theequipSoundrecord component.intgetProtection(ArmorItem.Type type) Returns the amount of armor protection points offered by anArmorItemusing thisArmorMaterialwhile it is worn by a player.final inthashCode()Returns a hash code value for this object.floatReturns the value of theknockbackResistancerecord component.layers()Returns the value of thelayersrecord component.Returns the value of therepairIngredientrecord component.final StringtoString()Returns a string representation of this record class.floatReturns the value of thetoughnessrecord component.
-
Field Details
-
defense
The field for thedefenserecord component. -
enchantability
private final int enchantabilityThe field for theenchantabilityrecord component. -
equipSound
The field for theequipSoundrecord component. -
repairIngredient
The field for therepairIngredientrecord component. -
layers
The field for thelayersrecord component. -
toughness
private final float toughnessThe field for thetoughnessrecord component. -
knockbackResistance
private final float knockbackResistanceThe field for theknockbackResistancerecord component. -
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/item/ArmorMaterial;CODEC:Lcom/mojang/serialization/Codec;intermediary field_48840Lnet/minecraft/class_1741;field_48840:Lcom/mojang/serialization/Codec;official aLcsg;a:Lcom/mojang/serialization/Codec;
-
-
Constructor Details
-
ArmorMaterial
public ArmorMaterial(Map<ArmorItem.Type, Integer> map, int int2, RegistryEntry<SoundEvent> registryEntry, Supplier<Ingredient> supplier, List<ArmorMaterial.Layer> list, float float2, float float3)
-
-
Method Details
-
getProtection
Returns the amount of armor protection points offered by anArmorItemusing thisArmorMaterialwhile it is worn by a player.The protection value returned here is applied as an
EntityAttributeModifierto a player wearing theArmorItempiece via theEntityAttributeModifier.Operation.ADD_VALUEmodifier.- Parameters:
type- theArmorItem.Typeof theItemwith thisArmorMaterial- Returns:
- the amount of armor protection points offered by an
ArmorItemwith thisArmorMaterial - Mappings:
Namespace Name Mixin selector named getProtectionLnet/minecraft/item/ArmorMaterial;getProtection(Lnet/minecraft/item/ArmorItem$Type;)Iintermediary method_48403Lnet/minecraft/class_1741;method_48403(Lnet/minecraft/class_1738$class_8051;)Iofficial aLcsg;a(Lcsf$a;)I
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
defense
Returns the value of thedefenserecord component.- Returns:
- the value of the
defenserecord component
-
enchantability
public int enchantability()Returns the value of theenchantabilityrecord component.- Returns:
- the value of the
enchantabilityrecord component
-
equipSound
Returns the value of theequipSoundrecord component.- Returns:
- the value of the
equipSoundrecord component
-
repairIngredient
Returns the value of therepairIngredientrecord component.- Returns:
- the value of the
repairIngredientrecord component
-
layers
Returns the value of thelayersrecord component.- Returns:
- the value of the
layersrecord component
-
toughness
public float toughness()Returns the value of thetoughnessrecord component.- Returns:
- the value of the
toughnessrecord component
-
knockbackResistance
public float knockbackResistance()Returns the value of theknockbackResistancerecord component.- Returns:
- the value of the
knockbackResistancerecord component
-