2020-04-02 23:07:06 +02:00
|
|
|
From a4dc5c42909b4ea232dcb14bab10f40606096a83 Mon Sep 17 00:00:00 2001
|
2018-08-17 23:55:40 +02:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Sat, 21 Jul 2018 03:11:03 -0500
|
|
|
|
Subject: [PATCH] PlayerLaunchProjectileEvent
|
|
|
|
|
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/InteractionResultWrapper.java b/src/main/java/net/minecraft/server/InteractionResultWrapper.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 5cab47a282..886babdcda 100644
|
2019-12-15 19:25:10 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/InteractionResultWrapper.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/InteractionResultWrapper.java
|
|
|
|
@@ -10,6 +10,7 @@ public class InteractionResultWrapper<T> {
|
|
|
|
this.b = t0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ public EnumInteractionResult getResult() { return this.a(); } // Paper - OBFHELPER
|
|
|
|
public EnumInteractionResult a() {
|
|
|
|
return this.a;
|
|
|
|
}
|
2018-08-17 23:55:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemEgg.java b/src/main/java/net/minecraft/server/ItemEgg.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 6fccd70a03..16f1b734e0 100644
|
2018-08-17 23:55:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemEgg.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemEgg.java
|
2020-01-28 20:43:57 +01:00
|
|
|
@@ -16,21 +16,35 @@ public class ItemEgg extends Item {
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2019-04-30 03:20:24 +02:00
|
|
|
entityegg.setItem(itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
entityegg.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
|
2020-01-28 20:43:57 +01:00
|
|
|
- // CraftBukkit start
|
|
|
|
- if (!world.addEntity(entityegg)) {
|
2018-08-17 23:55:40 +02:00
|
|
|
+ // Paper start
|
|
|
|
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityegg.getBukkitEntity());
|
|
|
|
+ if (event.callEvent() && world.addEntity(entityegg)) {
|
|
|
|
+ if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
+ itemstack.subtract(1);
|
|
|
|
+ } else if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+
|
2019-12-15 19:25:10 +01:00
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2018-08-17 23:55:40 +02:00
|
|
|
+ } else {
|
2020-01-28 20:43:57 +01:00
|
|
|
if (entityhuman instanceof EntityPlayer) {
|
|
|
|
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
}
|
|
|
|
- return InteractionResultWrapper.fail(itemstack);
|
2019-12-15 19:25:10 +01:00
|
|
|
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
|
2020-01-28 20:43:57 +01:00
|
|
|
}
|
|
|
|
- // CraftBukkit end
|
2018-08-17 23:55:40 +02:00
|
|
|
+ // Paper end
|
2020-01-28 20:43:57 +01:00
|
|
|
+
|
|
|
|
+
|
2018-08-17 23:55:40 +02:00
|
|
|
}
|
2020-01-28 20:43:57 +01:00
|
|
|
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemEgg.i.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - from above
|
2018-08-17 23:55:40 +02:00
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
+ /* // Paper start - moved up
|
2018-08-17 23:55:40 +02:00
|
|
|
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2019-12-15 19:25:10 +01:00
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
itemstack.subtract(1);
|
|
|
|
}
|
|
|
|
+ */ // Paper end
|
|
|
|
|
2020-01-22 03:02:07 +01:00
|
|
|
return InteractionResultWrapper.success(itemstack);
|
2019-12-15 19:25:10 +01:00
|
|
|
}
|
2018-08-17 23:55:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemEnderPearl.java b/src/main/java/net/minecraft/server/ItemEnderPearl.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index cab869e8e9..b57e9f7e72 100644
|
2018-08-17 23:55:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemEnderPearl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemEnderPearl.java
|
2019-12-15 19:25:10 +01:00
|
|
|
@@ -16,22 +16,37 @@ public class ItemEnderPearl extends Item {
|
2018-08-17 23:55:40 +02:00
|
|
|
|
2019-04-30 03:20:24 +02:00
|
|
|
entityenderpearl.setItem(itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
entityenderpearl.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
|
|
|
|
- if (!world.addEntity(entityenderpearl)) {
|
|
|
|
+ // Paper start
|
2019-12-15 19:25:10 +01:00
|
|
|
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityenderpearl.getBukkitEntity());
|
2018-08-17 23:55:40 +02:00
|
|
|
+ if (event.callEvent() && world.addEntity(entityenderpearl)) {
|
|
|
|
+ if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
+ itemstack.subtract(1);
|
|
|
|
+ } else if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+
|
2019-12-15 19:25:10 +01:00
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2019-08-05 04:15:53 +02:00
|
|
|
+ entityhuman.getCooldownTracker().setCooldown(this, 20);
|
2018-08-17 23:55:40 +02:00
|
|
|
+ } else {
|
|
|
|
+ // Paper end
|
|
|
|
if (entityhuman instanceof EntityPlayer) {
|
|
|
|
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
}
|
2019-12-15 19:25:10 +01:00
|
|
|
- return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack);
|
|
|
|
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
- entityhuman.getCooldownTracker().setCooldown(this, 20);
|
|
|
|
- // CraftBukkit end
|
|
|
|
-
|
|
|
|
- entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2018-08-17 23:55:40 +02:00
|
|
|
- if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
- itemstack.subtract(1);
|
|
|
|
- }
|
2019-12-15 19:25:10 +01:00
|
|
|
+ // Paper start - moved up
|
|
|
|
+// world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+// entityhuman.getCooldownTracker().setCooldown(this, 20);
|
|
|
|
+// // CraftBukkit end
|
|
|
|
+//
|
|
|
|
+// entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2019-07-20 06:01:24 +02:00
|
|
|
+// if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
+// itemstack.subtract(1);
|
|
|
|
+// }
|
2019-12-15 19:25:10 +01:00
|
|
|
+ // Paper end
|
2018-08-17 23:55:40 +02:00
|
|
|
|
2020-01-22 03:02:07 +01:00
|
|
|
return InteractionResultWrapper.success(itemstack);
|
2019-12-15 19:25:10 +01:00
|
|
|
}
|
2018-08-17 23:55:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemExpBottle.java b/src/main/java/net/minecraft/server/ItemExpBottle.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 071688b3ab..1d575af526 100644
|
2018-08-17 23:55:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemExpBottle.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemExpBottle.java
|
2019-12-15 19:25:10 +01:00
|
|
|
@@ -15,19 +15,38 @@ public class ItemExpBottle extends Item {
|
2018-08-17 23:55:40 +02:00
|
|
|
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
2018-09-01 00:56:57 +02:00
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+// world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.i.nextFloat() * 0.4F + 0.8F)); // Paper - moved down
|
2018-08-17 23:55:40 +02:00
|
|
|
if (!world.isClientSide) {
|
|
|
|
EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, entityhuman);
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2019-04-30 03:20:24 +02:00
|
|
|
entitythrownexpbottle.setItem(itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
entitythrownexpbottle.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.7F, 1.0F);
|
|
|
|
- world.addEntity(entitythrownexpbottle);
|
|
|
|
+ // Paper start
|
|
|
|
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitythrownexpbottle.getBukkitEntity());
|
|
|
|
+ if (event.callEvent() && world.addEntity(entitythrownexpbottle)) {
|
|
|
|
+ if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
+ itemstack.subtract(1);
|
|
|
|
+ } else if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+
|
2019-12-15 19:25:10 +01:00
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2018-08-17 23:55:40 +02:00
|
|
|
+ } else {
|
|
|
|
+ if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
2019-12-15 19:25:10 +01:00
|
|
|
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
+ /* // Paper start - moved up
|
2018-08-17 23:55:40 +02:00
|
|
|
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2019-12-15 19:25:10 +01:00
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
itemstack.subtract(1);
|
|
|
|
}
|
|
|
|
+ */ // Paper end
|
|
|
|
|
2020-01-22 03:02:07 +01:00
|
|
|
return InteractionResultWrapper.success(itemstack);
|
2019-12-15 19:25:10 +01:00
|
|
|
}
|
2018-08-17 23:55:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index c19b678cfb..7672e31fc0 100644
|
2018-08-17 23:55:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
2019-12-15 19:25:10 +01:00
|
|
|
@@ -8,7 +8,11 @@ public class ItemLingeringPotion extends ItemPotionThrowable {
|
|
|
|
|
2019-04-30 03:20:24 +02:00
|
|
|
@Override
|
2018-08-17 23:55:40 +02:00
|
|
|
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
2019-12-15 19:25:10 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
- return super.a(world, entityhuman, enumhand);
|
|
|
|
+ // Paper start
|
|
|
|
+ InteractionResultWrapper<ItemStack> wrapper = super.a(world, entityhuman, enumhand);
|
|
|
|
+ if (wrapper.getResult() != EnumInteractionResult.FAIL)
|
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ return wrapper;
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemPotionThrowable.java b/src/main/java/net/minecraft/server/ItemPotionThrowable.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 5d1f118c51..d1beab1ab7 100644
|
2019-12-15 19:25:10 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemPotionThrowable.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemPotionThrowable.java
|
|
|
|
@@ -15,13 +15,31 @@ public class ItemPotionThrowable extends ItemPotion {
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
entitypotion.setItem(itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
entitypotion.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.5F, 1.0F);
|
|
|
|
- world.addEntity(entitypotion);
|
|
|
|
+ // Paper start
|
|
|
|
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitypotion.getBukkitEntity());
|
|
|
|
+ if (event.callEvent() && world.addEntity(entitypotion)) {
|
|
|
|
+ if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
+ itemstack.subtract(1);
|
|
|
|
+ } else if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+
|
2019-12-15 19:25:10 +01:00
|
|
|
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2018-08-17 23:55:40 +02:00
|
|
|
+ } else {
|
|
|
|
+ if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
2019-12-15 19:25:10 +01:00
|
|
|
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2019-12-15 19:25:10 +01:00
|
|
|
+ /* // Paper start - moved up
|
2018-08-17 23:55:40 +02:00
|
|
|
entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2019-12-15 19:25:10 +01:00
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
itemstack.subtract(1);
|
|
|
|
}
|
|
|
|
+ */ // Paper end
|
|
|
|
|
2020-01-22 03:02:07 +01:00
|
|
|
return InteractionResultWrapper.success(itemstack);
|
2019-12-15 19:25:10 +01:00
|
|
|
}
|
2018-08-17 23:55:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemSnowball.java b/src/main/java/net/minecraft/server/ItemSnowball.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 56ec508959..e6044e654b 100644
|
2018-08-17 23:55:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemSnowball.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemSnowball.java
|
2020-01-28 20:43:57 +01:00
|
|
|
@@ -17,19 +17,27 @@ public class ItemSnowball extends Item {
|
2018-08-17 23:55:40 +02:00
|
|
|
|
2019-04-30 03:20:24 +02:00
|
|
|
entitysnowball.setItem(itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
entitysnowball.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
|
|
|
|
- if (world.addEntity(entitysnowball)) {
|
|
|
|
- if (!entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
+ // Paper start
|
|
|
|
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity());
|
|
|
|
+ if (event.callEvent() && world.addEntity(entitysnowball)) {
|
|
|
|
+ if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
|
|
|
|
itemstack.subtract(1);
|
|
|
|
+ } else if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
}
|
|
|
|
|
2020-01-28 20:43:57 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
- } else if (entityhuman instanceof EntityPlayer) {
|
2018-08-17 23:55:40 +02:00
|
|
|
- ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
2019-12-15 19:25:10 +01:00
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
|
2018-08-17 23:55:40 +02:00
|
|
|
+ } else {
|
|
|
|
+ if (entityhuman instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
2019-12-15 19:25:10 +01:00
|
|
|
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
|
2018-08-17 23:55:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2019-12-15 19:25:10 +01:00
|
|
|
|
|
|
|
- entityhuman.b(StatisticList.ITEM_USED.b(this));
|
|
|
|
+// entityhuman.b(StatisticList.ITEM_USED.b(this)); // Paper - moved up
|
|
|
|
// CraftBukkit start - moved up
|
|
|
|
/*
|
|
|
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
2018-08-17 23:55:40 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemSplashPotion.java b/src/main/java/net/minecraft/server/ItemSplashPotion.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 18bd846cee..e71e933fff 100644
|
2018-08-17 23:55:40 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemSplashPotion.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemSplashPotion.java
|
2019-12-15 19:25:10 +01:00
|
|
|
@@ -8,7 +8,11 @@ public class ItemSplashPotion extends ItemPotionThrowable {
|
|
|
|
|
2019-04-30 03:20:24 +02:00
|
|
|
@Override
|
2018-08-17 23:55:40 +02:00
|
|
|
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
2019-12-15 19:25:10 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
- return super.a(world, entityhuman, enumhand);
|
|
|
|
+ // Paper start
|
|
|
|
+ InteractionResultWrapper<ItemStack> wrapper = super.a(world, entityhuman, enumhand);
|
|
|
|
+ if (wrapper.getResult() != EnumInteractionResult.FAIL)
|
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ return wrapper;
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
}
|
2018-08-17 23:55:40 +02:00
|
|
|
--
|
2020-03-15 21:03:36 +01:00
|
|
|
2.25.1
|
2018-08-17 23:55:40 +02:00
|
|
|
|