mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 10:34:40 +00:00
play a sound when picking up items
This commit is contained in:
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,
|
||||
|
||||
Reference in new issue
Block a user