32 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.world.level.block;
 | |
| 
 | |
| import com.mojang.serialization.MapCodec;
 | |
| import net.minecraft.core.BlockPos;
 | |
| import net.minecraft.sounds.SoundEvents;
 | |
| import net.minecraft.sounds.SoundSource;
 | |
| import net.minecraft.world.entity.projectile.Projectile;
 | |
| import net.minecraft.world.level.Level;
 | |
| import net.minecraft.world.level.block.state.BlockBehaviour;
 | |
| import net.minecraft.world.level.block.state.BlockState;
 | |
| import net.minecraft.world.phys.BlockHitResult;
 | |
| 
 | |
| public class AmethystBlock extends Block {
 | |
| 	public static final MapCodec<AmethystBlock> CODEC = simpleCodec(AmethystBlock::new);
 | |
| 
 | |
| 	@Override
 | |
| 	public MapCodec<? extends AmethystBlock> codec() {
 | |
| 		return CODEC;
 | |
| 	}
 | |
| 
 | |
| 	public AmethystBlock(BlockBehaviour.Properties properties) {
 | |
| 		super(properties);
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) {
 | |
| 		if (!level.isClientSide) {
 | |
| 			BlockPos blockPos = hit.getBlockPos();
 | |
| 			level.playSound(null, blockPos, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.BLOCKS, 1.0F, 0.5F + level.random.nextFloat() * 1.2F);
 | |
| 		}
 | |
| 	}
 | |
| }
 |