Record Class Accessory
java.lang.Object
java.lang.Record
tech.anonymoushacker1279.immersiveweapons.item.accessory.Accessory
public record Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, List<AccessoryEffectInstance> effects, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances, List<SerializableTooltip> tooltips)
extends Record
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAccessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, List<AccessoryEffectInstance> effects, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances, List<SerializableTooltip> tooltips) Creates an instance of aAccessoryrecord class.Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, AccessoryEffectBuilder builder) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributeModifiersrecord component.Returns the value of thedynamicAttributeModifiersrecord component.effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.doubledoublegetEffectValue(AccessoryEffectType type, net.minecraft.world.entity.player.Player player) static Set<AttributeOperation> The global attribute modifier map contains all standard and dynamic modifiers for all registered accessories.final inthashCode()Returns a hash code value for this object.static booleanisAccessoryActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item) static booleanisAccessoryActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Check if the specified accessory is active for the player.booleanisActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack accessoryStack, AccessorySlot slot) Check if this accessory is active.net.minecraft.core.Holder<net.minecraft.world.item.Item> item()Returns the value of theitemrecord component.List<net.minecraft.world.effect.MobEffectInstance> Returns the value of themobEffectInstancesrecord component.slot()Returns the value of theslotrecord component.tooltips()Returns the value of thetooltipsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, Accessory> STREAM_CODEC
-
-
Constructor Details
-
Accessory
public Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, AccessoryEffectBuilder builder) -
Accessory
public Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, List<AccessoryEffectInstance> effects, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances, List<SerializableTooltip> tooltips) Creates an instance of aAccessoryrecord class.- Parameters:
item- the value for theitemrecord componentslot- the value for theslotrecord componenteffects- the value for theeffectsrecord componentattributeModifiers- the value for theattributeModifiersrecord componentdynamicAttributeModifiers- the value for thedynamicAttributeModifiersrecord componentmobEffectInstances- the value for themobEffectInstancesrecord componenttooltips- the value for thetooltipsrecord component
-
-
Method Details
-
getGlobalAttributeModifiers
The global attribute modifier map contains all standard and dynamic modifiers for all registered accessories.- Returns:
- the global attribute modifier map
-
isAccessoryActive
public static boolean isAccessoryActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) Check if the specified accessory is active for the player.- Parameters:
player- thePlayerto checkstack- theItemStackto check- Returns:
- true if the accessory is active, false otherwise
-
isAccessoryActive
public static boolean isAccessoryActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item) -
isActive
public boolean isActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack accessoryStack, AccessorySlot slot) Check if this accessory is active.- Parameters:
player- thePlayerto check- Returns:
- true if the accessory is active, false otherwise
-
getBaseEffectValue
-
getEffectValue
public double getEffectValue(AccessoryEffectType type, net.minecraft.world.entity.player.Player player) -
toString
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
item
public net.minecraft.core.Holder<net.minecraft.world.item.Item> item()Returns the value of theitemrecord component.- Returns:
- the value of the
itemrecord component
-
slot
Returns the value of theslotrecord component.- Returns:
- the value of the
slotrecord component
-
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-
attributeModifiers
Returns the value of theattributeModifiersrecord component.- Returns:
- the value of the
attributeModifiersrecord component
-
dynamicAttributeModifiers
Returns the value of thedynamicAttributeModifiersrecord component.- Returns:
- the value of the
dynamicAttributeModifiersrecord component
-
mobEffectInstances
Returns the value of themobEffectInstancesrecord component.- Returns:
- the value of the
mobEffectInstancesrecord component
-
tooltips
Returns the value of thetooltipsrecord component.- Returns:
- the value of the
tooltipsrecord component
-