From ead447789ca6cbd6be3f6517d5be4a4d29d69b4e Mon Sep 17 00:00:00 2001 From: Mitchell Skaggs Date: Fri, 6 Aug 2021 04:57:02 -0500 Subject: [PATCH] Use standard `SoundEvent` instance for correct `Registry` behavior Registries use object identity for hashing and comparison, so creating a new `SoundEvent` instance isn't guaranteed to return the same registry entry for network serialization, etc. Closes #1 --- .../andrewlalis/speed_carts/mixin/AbstractMinecartMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/nl/andrewlalis/speed_carts/mixin/AbstractMinecartMixin.java b/src/main/java/nl/andrewlalis/speed_carts/mixin/AbstractMinecartMixin.java index ff0f644..dd6354d 100644 --- a/src/main/java/nl/andrewlalis/speed_carts/mixin/AbstractMinecartMixin.java +++ b/src/main/java/nl/andrewlalis/speed_carts/mixin/AbstractMinecartMixin.java @@ -14,7 +14,7 @@ import net.minecraft.entity.MovementType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.vehicle.AbstractMinecartEntity; import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; import net.minecraft.state.property.Properties; import net.minecraft.text.Text; import net.minecraft.util.DyeColor; @@ -156,7 +156,7 @@ public abstract class AbstractMinecartMixin extends Entity { if (this.hasPlayerRider()) { PlayerEntity player = (PlayerEntity) this.getFirstPassenger(); if (player != null) { - player.playSound(new SoundEvent(new Identifier("block.note_block.bell")), SoundCategory.PLAYERS, 1.0f, 1.0f); + player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BELL, SoundCategory.PLAYERS, 1.0f, 1.0f); } } return true; -- 2.34.1