Record Class AmbientLeavesBlockSoundPlayer
java.lang.Object
java.lang.Record
net.minecraft.world.level.block.sounds.AmbientLeavesBlockSoundPlayer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final Optional<Holder<SoundEvent>> The field for theambientSoundrecord component.private final intThe field for thechancerecord component.static final com.mojang.serialization.Codec<AmbientLeavesBlockSoundPlayer> private static final intprivate static final intprivate final intThe field for thenearbySameLeavesRequiredrecord component.private final intThe field for thenearbySatisfyingBlocksRequiredrecord component.private static final AmbientLeavesBlockSoundPlayerThe field for thesatisfyingBlocksrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionAmbientLeavesBlockSoundPlayer(Optional<Holder<SoundEvent>> ambientSound, int chance, Optional<TagKey<Block>> satisfyingBlocks, int nearbySatisfyingBlocksRequired, int nearbySameLeavesRequired) Creates an instance of aAmbientLeavesBlockSoundPlayerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theambientSoundrecord component.intchance()Returns the value of thechancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thenearbySameLeavesRequiredrecord component.intReturns the value of thenearbySatisfyingBlocksRequiredrecord component.of(Holder<SoundEvent> ambientSound, TagKey<Block> satisfyingBlocks) voidplayAmbientLeavesSounds(Level level, BlockPos pos, Block block, RandomSource random) Returns the value of thesatisfyingBlocksrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ambientSound
The field for theambientSoundrecord component. -
chance
private final int chanceThe field for thechancerecord component. -
satisfyingBlocks
-
nearbySatisfyingBlocksRequired
private final int nearbySatisfyingBlocksRequiredThe field for thenearbySatisfyingBlocksRequiredrecord component. -
nearbySameLeavesRequired
private final int nearbySameLeavesRequiredThe field for thenearbySameLeavesRequiredrecord component. -
AMBIENT_SOUND_CHANCE
private static final int AMBIENT_SOUND_CHANCE- See Also:
-
NEARBY_SATISFYING_BLOCKS_REQUIRED
private static final int NEARBY_SATISFYING_BLOCKS_REQUIRED- See Also:
-
NEARBY_SAME_LEAVES_REQUIRED
private static final int NEARBY_SAME_LEAVES_REQUIRED- See Also:
-
CODEC
-
NO_SOUND
-
-
Constructor Details
-
AmbientLeavesBlockSoundPlayer
public AmbientLeavesBlockSoundPlayer(Optional<Holder<SoundEvent>> ambientSound, int chance, Optional<TagKey<Block>> satisfyingBlocks, int nearbySatisfyingBlocksRequired, int nearbySameLeavesRequired) Creates an instance of aAmbientLeavesBlockSoundPlayerrecord class.- Parameters:
ambientSound- the value for theambientSoundrecord componentchance- the value for thechancerecord componentsatisfyingBlocks- the value for thesatisfyingBlocksrecord componentnearbySatisfyingBlocksRequired- the value for thenearbySatisfyingBlocksRequiredrecord componentnearbySameLeavesRequired- the value for thenearbySameLeavesRequiredrecord component
-
-
Method Details
-
of
public static AmbientLeavesBlockSoundPlayer of(Holder<SoundEvent> ambientSound, TagKey<Block> satisfyingBlocks) -
noAmbientSound
-
playAmbientLeavesSounds
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
ambientSound
Returns the value of theambientSoundrecord component.- Returns:
- the value of the
ambientSoundrecord component
-
chance
public int chance()Returns the value of thechancerecord component.- Returns:
- the value of the
chancerecord component
-
satisfyingBlocks
-
nearbySatisfyingBlocksRequired
public int nearbySatisfyingBlocksRequired()Returns the value of thenearbySatisfyingBlocksRequiredrecord component.- Returns:
- the value of the
nearbySatisfyingBlocksRequiredrecord component
-
nearbySameLeavesRequired
public int nearbySameLeavesRequired()Returns the value of thenearbySameLeavesRequiredrecord component.- Returns:
- the value of the
nearbySameLeavesRequiredrecord component
-