Record Class ExplodeEffect

java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.effects.ExplodeEffect
All Implemented Interfaces:
EnchantmentEntityEffect, EnchantmentLocationBasedEffect

public record ExplodeEffect(boolean attributeToUser, Optional<Holder<DamageType>> damageType, Optional<LevelBasedValue> knockbackMultiplier, Optional<HolderSet<Block>> immuneBlocks, Vec3 offset, LevelBasedValue radius, boolean createFire, Level.ExplosionInteraction blockInteraction, ParticleOptions smallParticle, ParticleOptions largeParticle, Holder<SoundEvent> sound) extends Record implements EnchantmentEntityEffect
  • Field Details

    • attributeToUser

      private final boolean attributeToUser
      The field for the attributeToUser record component.
    • damageType

      private final Optional<Holder<DamageType>> damageType
      The field for the damageType record component.
    • knockbackMultiplier

      private final Optional<LevelBasedValue> knockbackMultiplier
      The field for the knockbackMultiplier record component.
    • immuneBlocks

      private final Optional<HolderSet<Block>> immuneBlocks
      The field for the immuneBlocks record component.
    • offset

      private final Vec3 offset
      The field for the offset record component.
    • radius

      private final LevelBasedValue radius
      The field for the radius record component.
    • createFire

      private final boolean createFire
      The field for the createFire record component.
    • blockInteraction

      private final Level.ExplosionInteraction blockInteraction
      The field for the blockInteraction record component.
    • smallParticle

      private final ParticleOptions smallParticle
      The field for the smallParticle record component.
    • largeParticle

      private final ParticleOptions largeParticle
      The field for the largeParticle record component.
    • sound

      private final Holder<SoundEvent> sound
      The field for the sound record component.
    • CODEC

      public static final com.mojang.serialization.MapCodec<ExplodeEffect> CODEC
  • Constructor Details

    • ExplodeEffect

      public ExplodeEffect(boolean attributeToUser, Optional<Holder<DamageType>> damageType, Optional<LevelBasedValue> knockbackMultiplier, Optional<HolderSet<Block>> immuneBlocks, Vec3 offset, LevelBasedValue radius, boolean createFire, Level.ExplosionInteraction blockInteraction, ParticleOptions smallParticle, ParticleOptions largeParticle, Holder<SoundEvent> sound)
      Creates an instance of a ExplodeEffect record class.
      Parameters:
      attributeToUser - the value for the attributeToUser record component
      damageType - the value for the damageType record component
      knockbackMultiplier - the value for the knockbackMultiplier record component
      immuneBlocks - the value for the immuneBlocks record component
      offset - the value for the offset record component
      radius - the value for the radius record component
      createFire - the value for the createFire record component
      blockInteraction - the value for the blockInteraction record component
      smallParticle - the value for the smallParticle record component
      largeParticle - the value for the largeParticle record component
      sound - the value for the sound record component
  • Method Details

    • apply

      public void apply(ServerLevel p_346186_, int p_345966_, EnchantedItemInUse p_346324_, Entity p_345305_, Vec3 p_344916_)
      Specified by:
      apply in interface EnchantmentEntityEffect
    • getDamageSource

      @Nullable private DamageSource getDamageSource(Entity p_346246_, Vec3 p_345332_)
    • codec

      public com.mojang.serialization.MapCodec<ExplodeEffect> codec()
      Specified by:
      codec in interface EnchantmentEntityEffect
      Specified by:
      codec in interface EnchantmentLocationBasedEffect
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • attributeToUser

      public boolean attributeToUser()
      Returns the value of the attributeToUser record component.
      Returns:
      the value of the attributeToUser record component
    • damageType

      public Optional<Holder<DamageType>> damageType()
      Returns the value of the damageType record component.
      Returns:
      the value of the damageType record component
    • knockbackMultiplier

      public Optional<LevelBasedValue> knockbackMultiplier()
      Returns the value of the knockbackMultiplier record component.
      Returns:
      the value of the knockbackMultiplier record component
    • immuneBlocks

      public Optional<HolderSet<Block>> immuneBlocks()
      Returns the value of the immuneBlocks record component.
      Returns:
      the value of the immuneBlocks record component
    • offset

      public Vec3 offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • radius

      public LevelBasedValue radius()
      Returns the value of the radius record component.
      Returns:
      the value of the radius record component
    • createFire

      public boolean createFire()
      Returns the value of the createFire record component.
      Returns:
      the value of the createFire record component
    • blockInteraction

      public Level.ExplosionInteraction blockInteraction()
      Returns the value of the blockInteraction record component.
      Returns:
      the value of the blockInteraction record component
    • smallParticle

      public ParticleOptions smallParticle()
      Returns the value of the smallParticle record component.
      Returns:
      the value of the smallParticle record component
    • largeParticle

      public ParticleOptions largeParticle()
      Returns the value of the largeParticle record component.
      Returns:
      the value of the largeParticle record component
    • sound

      public Holder<SoundEvent> sound()
      Returns the value of the sound record component.
      Returns:
      the value of the sound record component