Record Class KineticWeapon
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.KineticWeapon
public record KineticWeapon(int contactCooldownTicks, int delayTicks, Optional<KineticWeapon.Condition> dismountConditions, Optional<KineticWeapon.Condition> knockbackConditions, Optional<KineticWeapon.Condition> damageConditions, float forwardMovement, float damageMultiplier, Optional<Holder<SoundEvent>> sound, Optional<Holder<SoundEvent>> hitSound)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<KineticWeapon> private final intThe field for thecontactCooldownTicksrecord component.private final Optional<KineticWeapon.Condition> The field for thedamageConditionsrecord component.private final floatThe field for thedamageMultiplierrecord component.private final intThe field for thedelayTicksrecord component.private final Optional<KineticWeapon.Condition> The field for thedismountConditionsrecord component.private final floatThe field for theforwardMovementrecord component.static final intprivate final Optional<Holder<SoundEvent>> The field for thehitSoundrecord component.private final Optional<KineticWeapon.Condition> The field for theknockbackConditionsrecord component.private final Optional<Holder<SoundEvent>> The field for thesoundrecord component.static final StreamCodec<RegistryFriendlyByteBuf, KineticWeapon> -
Constructor Summary
ConstructorsConstructorDescriptionKineticWeapon(int contactCooldownTicks, int delayTicks, Optional<KineticWeapon.Condition> dismountConditions, Optional<KineticWeapon.Condition> knockbackConditions, Optional<KineticWeapon.Condition> damageConditions, float forwardMovement, float damageMultiplier, Optional<Holder<SoundEvent>> sound, Optional<Holder<SoundEvent>> hitSound) Creates an instance of aKineticWeaponrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintintReturns the value of thecontactCooldownTicksrecord component.Returns the value of thedamageConditionsrecord component.voiddamageEntities(ItemStack pStack, int pRemainingUseDuration, LivingEntity pEntity, EquipmentSlot pSlot) floatReturns the value of thedamageMultiplierrecord component.intReturns the value of thedelayTicksrecord component.Returns the value of thedismountConditionsrecord component.final booleanIndicates whether some other object is "equal to" this one.floatReturns the value of theforwardMovementrecord component.static Vec3final inthashCode()Returns a hash code value for this object.hitSound()Returns the value of thehitSoundrecord component.Returns the value of theknockbackConditionsrecord component.voidmakeLocalHitSound(Entity pEntity) voidsound()Returns the value of thesoundrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
contactCooldownTicks
private final int contactCooldownTicksThe field for thecontactCooldownTicksrecord component. -
delayTicks
private final int delayTicksThe field for thedelayTicksrecord component. -
dismountConditions
The field for thedismountConditionsrecord component. -
knockbackConditions
The field for theknockbackConditionsrecord component. -
damageConditions
The field for thedamageConditionsrecord component. -
forwardMovement
private final float forwardMovementThe field for theforwardMovementrecord component. -
damageMultiplier
private final float damageMultiplierThe field for thedamageMultiplierrecord component. -
sound
The field for thesoundrecord component. -
hitSound
The field for thehitSoundrecord component. -
HIT_FEEDBACK_TICKS
public static final int HIT_FEEDBACK_TICKS- See Also:
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
KineticWeapon
public KineticWeapon(int contactCooldownTicks, int delayTicks, Optional<KineticWeapon.Condition> dismountConditions, Optional<KineticWeapon.Condition> knockbackConditions, Optional<KineticWeapon.Condition> damageConditions, float forwardMovement, float damageMultiplier, Optional<Holder<SoundEvent>> sound, Optional<Holder<SoundEvent>> hitSound) Creates an instance of aKineticWeaponrecord class.- Parameters:
contactCooldownTicks- the value for thecontactCooldownTicksrecord componentdelayTicks- the value for thedelayTicksrecord componentdismountConditions- the value for thedismountConditionsrecord componentknockbackConditions- the value for theknockbackConditionsrecord componentdamageConditions- the value for thedamageConditionsrecord componentforwardMovement- the value for theforwardMovementrecord componentdamageMultiplier- the value for thedamageMultiplierrecord componentsound- the value for thesoundrecord componenthitSound- the value for thehitSoundrecord component
-
-
Method Details
-
getMotion
-
makeSound
-
makeLocalHitSound
-
computeDamageUseDuration
public int computeDamageUseDuration() -
damageEntities
public void damageEntities(ItemStack pStack, int pRemainingUseDuration, LivingEntity pEntity, EquipmentSlot pSlot) -
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 '=='. -
contactCooldownTicks
public int contactCooldownTicks()Returns the value of thecontactCooldownTicksrecord component.- Returns:
- the value of the
contactCooldownTicksrecord component
-
delayTicks
public int delayTicks()Returns the value of thedelayTicksrecord component.- Returns:
- the value of the
delayTicksrecord component
-
dismountConditions
Returns the value of thedismountConditionsrecord component.- Returns:
- the value of the
dismountConditionsrecord component
-
knockbackConditions
Returns the value of theknockbackConditionsrecord component.- Returns:
- the value of the
knockbackConditionsrecord component
-
damageConditions
Returns the value of thedamageConditionsrecord component.- Returns:
- the value of the
damageConditionsrecord component
-
forwardMovement
public float forwardMovement()Returns the value of theforwardMovementrecord component.- Returns:
- the value of the
forwardMovementrecord component
-
damageMultiplier
public float damageMultiplier()Returns the value of thedamageMultiplierrecord component.- Returns:
- the value of the
damageMultiplierrecord component
-
sound
Returns the value of thesoundrecord component.- Returns:
- the value of the
soundrecord component
-
hitSound
Returns the value of thehitSoundrecord component.- Returns:
- the value of the
hitSoundrecord component
-