mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 20:22:28 +00:00
Fix EntityItemPickupEvent 'pop' sound spamming.
This commit is contained in:
1 parent
912072535d
commit
20e38dca99
2 files changed
+18
-4
No files matched your search
@@ -10,14 +10,17 @@
|
||||
|
||||
public class EntityItem extends Entity
|
||||
{
|
||||
@@ -238,6 +241,23 @@
|
||||
@@ -238,6 +241,26 @@
|
||||
{
|
||||
int var2 = this.item.stackSize;
|
||||
|
||||
+ EntityItemPickupEvent event = new EntityItemPickupEvent(par1EntityPlayer, this);
|
||||
+ MinecraftForge.EVENT_BUS.post(event);
|
||||
+
|
||||
+ if (delayBeforeCanPickup == 0 && (!event.isCanceled() || item.stackSize <= 0))
|
||||
+ if (MinecraftForge.EVENT_BUS.post(event))
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (delayBeforeCanPickup == 0 && (event.isHandled() || item.stackSize <= 0))
|
||||
+ {
|
||||
+ //FML Notify pickup
|
||||
+ worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
|
||||
Reference in new issue
Block a user