play a sound when picking up items

This commit is contained in:
Alexdoru committed 2025-06-04 17:13:21 +02:00
1 parent 8aa0eddb24
commit dd0554ce64
1 file changed
+10
@@ -63,6 +63,7 @@ public class WirelessMagnet {
(int) player.posZ,
magnetRange);
final boolean skipPlayerCheck = world.playerEntities.size() < 2;
boolean playSound = false;
for (EntityItem itemToGet : items) {
if (!skipPlayerCheck) {
@@ -75,6 +76,7 @@ public class WirelessMagnet {
}
if (itemToGet.delayBeforeCanPickup <= 0) {
playSound = true;
itemToGet.motionX = 0;
itemToGet.motionY = 0;
itemToGet.motionZ = 0;
@@ -85,6 +87,14 @@ public class WirelessMagnet {
}
}
if (playSound) {
world.playSoundAtEntity(
player,
"random.orb",
0.1F,
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 2F));
}
// xp
final List<EntityXPOrb> xpOrbs = getEntitiesInRange(
EntityXPOrb.class,