This repository has been archived on 2025-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
Files
GamerItems/src/main/java/net/arcmods/ryantlg/blockClasses/elon.java
2022-03-17 18:59:32 +02:00

35 lines
1.4 KiB
Java
Executable File

package net.arcmods.ryantlg.blockClasses;
import net.arcmods.ryantlg.sounds;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class elon extends Block{
public elon(Settings settings) {
super(settings);
}
@Override
public ActionResult onUse(BlockState blockState, World world, BlockPos blockPos, PlayerEntity placedBy, Hand hand, BlockHitResult blockHitResult) {
if (!world.isClient) {
world.playSound(
null, // Player - if non-null, will play sound for every nearby player *except* the specified player
blockPos, // The position of where the sound will come from
sounds.ELON_SOUND_EVENT, // The sound that will play
SoundCategory.BLOCKS, // This determines which of the volume sliders affect this sound
1f, //Volume multiplier, 1 is normal, 0.5 is half volume, etc
1f // Pitch multiplier, 1 is normal, 0.5 is half pitch, etc
);
}
return ActionResult.FAIL;
}
}