AmethystBlock .java

net.minecraft.world.level.block.AmethystBlock (class, 25 lines): extends Block. members: onProjectileHit. imports: Projectile, BlockHitResult, SoundSource.

net.minecraft.world.level.blockclass25 linescommonextends Block924 B

API Surface (1)

void onProjectileHit(final Level level, final BlockState state, final BlockHitResult hitResult, final Projectile projectile)

Full Source

AmethystBlock.java25 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.sounds.SoundEvents;
5
import net.minecraft.sounds.SoundSource;
6
import net.minecraft.world.entity.projectile.Projectile;
7
import net.minecraft.world.level.Level;
8
import net.minecraft.world.level.block.state.BlockBehaviour;
9
import net.minecraft.world.level.block.state.BlockState;
10
import net.minecraft.world.phys.BlockHitResult;
11
12
public class AmethystBlock extends Block {
13
	public AmethystBlock(final BlockBehaviour.Properties props) {
14
		super(props);
15
	}
16
17
	@Override
18
	protected void onProjectileHit(final Level level, final BlockState state, final BlockHitResult hitResult, final Projectile projectile) {
19
		if (!level.isClientSide()) {
20
			BlockPos hitPos = hitResult.getBlockPos();
21
			level.playSound(null, hitPos, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.BLOCKS, 1.0F, 0.5F + level.getRandom().nextFloat() * 1.2F);
22
		}
23
	}
24
}
25

Decompiled Minecraft 26.3 source of AmethystBlock (net/minecraft/world/level/block/AmethystBlock.java) with Mojang official mappings, stored verbatim on the site.