Skip to content

Commit

Permalink
Vibration update: Final touches
Browse files Browse the repository at this point in the history
- add vibration for breaking blocks with bore lens burst
- improve game event call for HornItem
  • Loading branch information
TheRealWormbo authored and artemisSystem committed Jul 27, 2024
1 parent 566ca1a commit 8421f0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, @NotNu
public void onUseTick(Level world, @NotNull LivingEntity living, @NotNull ItemStack stack, int time) {
if (!world.isClientSide) {
if (time != getUseDuration(stack) && time % 5 == 0) {
world.gameEvent(living, GameEvent.INSTRUMENT_PLAY, living.position());
living.gameEvent(GameEvent.INSTRUMENT_PLAY);
breakGrass(world, stack, living.blockPosition(), living);
}
world.playSound(null, living.getX(), living.getY(), living.getZ(), BotaniaSounds.hornDoot, SoundSource.BLOCKS, 1F, 1F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.world.level.block.LevelEvent;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -75,6 +76,7 @@ && canHarvest(harvestLevel, state)
List<ItemStack> items = Block.getDrops(state, (ServerLevel) world, collidePos, tile);

world.removeBlock(collidePos, false);
world.gameEvent(entity, GameEvent.BLOCK_DESTROY, collidePos);
if (BotaniaConfig.common().blockBreakParticles()) {
world.levelEvent(LevelEvent.PARTICLES_DESTROY_BLOCK, collidePos, Block.getId(state));
}
Expand Down

0 comments on commit 8421f0d

Please sign in to comment.