2019-12-15 19:25:10 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 21 Jul 2018 03:11:03 -0500
Subject: [PATCH] PlayerLaunchProjectileEvent
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/InteractionResultWrapper.java b/src/main/java/net/minecraft/world/InteractionResultWrapper.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/InteractionResultWrapper.java
+++ b/src/main/java/net/minecraft/world/InteractionResultWrapper.java
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class InteractionResultWrapper<T> {
this.b = t0;
}
+ public EnumInteractionResult getResult() { return this.a(); } // Paper - OBFHELPER
public EnumInteractionResult a() {
return this.a;
}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemEgg.java b/src/main/java/net/minecraft/world/item/ItemEgg.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemEgg.java
+++ b/src/main/java/net/minecraft/world/item/ItemEgg.java
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemEgg extends Item {
entityegg.setItem(itemstack);
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)) {
2019-12-15 19:25:10 +01: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);
2021-03-16 08:19:45 +01:00
+ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
2019-12-15 19:25:10 +01:00
+ }
+
2021-03-16 08:19:45 +01:00
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
2019-12-15 19:25:10 +01:00
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
+ } else {
2021-03-16 08:19:45 +01:00
if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
2020-01-28 20:43:57 +01:00
}
- return InteractionResultWrapper.fail(itemstack);
2021-03-16 08:19:45 +01:00
+ return new InteractionResultWrapper<ItemStack>(net.minecraft.world.EnumInteractionResult.FAIL, itemstack);
2020-01-28 20:43:57 +01:00
}
- // CraftBukkit end
2019-12-15 19:25:10 +01:00
+ // Paper end
2020-01-28 20:43:57 +01:00
+
+
2019-12-15 19:25:10 +01:00
}
2020-06-26 01:38:24 +02:00
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemEgg.RANDOM.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - from above
2019-12-15 19:25:10 +01:00
+ /* // Paper start - moved up
entityhuman.b(StatisticList.ITEM_USED.b(this));
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}
+ */ // Paper end
2020-06-26 01:38:24 +02:00
return InteractionResultWrapper.a(itemstack, world.s_());
2019-12-15 19:25:10 +01:00
}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemEnderPearl.java b/src/main/java/net/minecraft/world/item/ItemEnderPearl.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemEnderPearl.java
+++ b/src/main/java/net/minecraft/world/item/ItemEnderPearl.java
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemEnderPearl extends Item {
entityenderpearl.setItem(itemstack);
entityenderpearl.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F);
- if (!world.addEntity(entityenderpearl)) {
+ // 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) entityenderpearl.getBukkitEntity());
+ if (event.callEvent() && world.addEntity(entityenderpearl)) {
+ if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) {
+ itemstack.subtract(1);
2021-03-16 08:19:45 +01:00
+ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
2019-12-15 19:25:10 +01:00
+ }
+
2021-03-16 08:19:45 +01:00
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F));
2019-12-15 19:25:10 +01:00
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
+ entityhuman.getCooldownTracker().setCooldown(this, 20);
+ } else {
+ // Paper end
2021-03-16 08:19:45 +01:00
if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
2019-12-15 19:25:10 +01:00
}
2021-03-16 08:19:45 +01:00
- return InteractionResultWrapper.fail(itemstack);
+ return new InteractionResultWrapper<ItemStack>(net.minecraft.world.EnumInteractionResult.FAIL, itemstack);
2019-12-15 19:25:10 +01:00
}
}
2020-06-26 01:38:24 +02:00
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.RANDOM.nextFloat() * 0.4F + 0.8F));
2019-12-15 19:25:10 +01:00
- entityhuman.getCooldownTracker().setCooldown(this, 20);
- // CraftBukkit end
-
- entityhuman.b(StatisticList.ITEM_USED.b(this));
- if (!entityhuman.abilities.canInstantlyBuild) {
- itemstack.subtract(1);
- }
+ // Paper start - moved up
2020-06-26 01:38:24 +02:00
+// world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.RANDOM.nextFloat() * 0.4F + 0.8F));
2019-12-15 19:25:10 +01:00
+// entityhuman.getCooldownTracker().setCooldown(this, 20);
+// // CraftBukkit end
+//
+// entityhuman.b(StatisticList.ITEM_USED.b(this));
+// if (!entityhuman.abilities.canInstantlyBuild) {
+// itemstack.subtract(1);
+// }
2020-06-26 01:38:24 +02:00
+ // Paper end - moved up
2019-12-15 19:25:10 +01:00
2020-06-26 01:38:24 +02:00
return InteractionResultWrapper.a(itemstack, world.s_());
2019-12-15 19:25:10 +01:00
}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemExpBottle.java b/src/main/java/net/minecraft/world/item/ItemExpBottle.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemExpBottle.java
+++ b/src/main/java/net/minecraft/world/item/ItemExpBottle.java
2021-03-16 16:50:45 +01:00
@@ -0,0 +0,0 @@
package net.minecraft.world.item;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.stats.StatisticList;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
+import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.projectile.EntityThrownExpBottle;
import net.minecraft.world.level.World;
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemExpBottle extends Item {
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.b(enumhand);
2020-06-26 01:38:24 +02:00
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.RANDOM.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.RANDOM.nextFloat() * 0.4F + 0.8F)); // Paper - moved down
2019-12-15 19:25:10 +01:00
if (!world.isClientSide) {
EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, entityhuman);
entitythrownexpbottle.setItem(itemstack);
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();
+ }
+
+ 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));
+ } else {
+ if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
+ }
+ // Paper end
}
+ /* // Paper start - moved up
entityhuman.b(StatisticList.ITEM_USED.b(this));
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}
+ */ // Paper end
2020-06-26 01:38:24 +02:00
return InteractionResultWrapper.a(itemstack, world.s_());
2019-12-15 19:25:10 +01:00
}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java
2020-10-27 23:01:32 +01:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java
+++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java
2021-03-16 16:50:45 +01:00
@@ -0,0 +0,0 @@ package net.minecraft.world.item;
import java.util.Arrays;
import java.util.Comparator;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
2020-10-27 23:01:32 +01:00
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
- world.addEntity(entityfireworks);
- itemstack.subtract(1);
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) itemactioncontext.getEntity().getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Firework) entityfireworks.getBukkitEntity());
+ if (!event.callEvent() || !world.addEntity(entityfireworks)) return EnumInteractionResult.PASS;
+ if (event.shouldConsume() && !itemactioncontext.getEntity().abilities.canInstantlyBuild) itemstack.subtract(1);
+ else if (itemactioncontext.getEntity() instanceof EntityPlayer) ((EntityPlayer) itemactioncontext.getEntity()).getBukkitEntity().updateInventory();
+ // Paper end
}
return EnumInteractionResult.a(world.isClientSide);
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java
+++ b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java
2021-03-16 16:50:45 +01:00
@@ -0,0 +0,0 @@ package net.minecraft.world.item;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.World;
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemLingeringPotion extends ItemPotionThrowable {
@Override
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
2020-06-26 01:38:24 +02:00
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.RANDOM.nextFloat() * 0.4F + 0.8F));
2019-12-15 19:25:10 +01:00
- return super.a(world, entityhuman, enumhand);
+ // Paper start
+ InteractionResultWrapper<ItemStack> wrapper = super.a(world, entityhuman, enumhand);
2020-06-26 01:38:24 +02:00
+ 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.RANDOM.nextFloat() * 0.4F + 0.8F));
+ }
2019-12-15 19:25:10 +01:00
+ return wrapper;
+ // Paper end
}
}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java
+++ b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java
2021-03-16 16:50:45 +01:00
@@ -0,0 +0,0 @@
package net.minecraft.world.item;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.stats.StatisticList;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.projectile.EntityPotion;
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemPotionThrowable extends ItemPotion {
entitypotion.setItem(itemstack);
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();
+ }
+
+ entityhuman.b(StatisticList.ITEM_USED.b(this));
+ } else {
+ if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack);
+ }
+ // Paper end
}
+ /* // Paper start - moved up
entityhuman.b(StatisticList.ITEM_USED.b(this));
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}
+ */ // Paper end
2020-06-26 01:38:24 +02:00
return InteractionResultWrapper.a(itemstack, world.s_());
2019-12-15 19:25:10 +01:00
}
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemSnowball.java b/src/main/java/net/minecraft/world/item/ItemSnowball.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemSnowball.java
+++ b/src/main/java/net/minecraft/world/item/ItemSnowball.java
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemSnowball extends Item {
entitysnowball.setItem(itemstack);
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) {
2020-06-26 01:38:24 +02:00
+ // Paper end
2019-12-15 19:25:10 +01:00
itemstack.subtract(1);
2021-03-16 08:19:45 +01:00
+ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { // Paper
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper
2019-12-15 19:25:10 +01:00
}
2020-06-26 01:38:24 +02:00
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.RANDOM.nextFloat() * 0.4F + 0.8F));
2021-03-16 08:19:45 +01:00
- } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
- ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
2020-06-26 01:38:24 +02:00
+ } else { // Paper
2021-03-16 08:19:45 +01:00
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper
+ return new InteractionResultWrapper<ItemStack>(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); // Paper
2019-12-15 19:25:10 +01:00
}
}
// CraftBukkit end
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java
2020-05-06 11:48:49 +02:00
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java
+++ b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java
2021-03-16 16:50:45 +01:00
@@ -0,0 +0,0 @@ package net.minecraft.world.item;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.EnumHand;
+import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.InteractionResultWrapper;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.World;
2019-12-15 19:25:10 +01:00
@@ -0,0 +0,0 @@ public class ItemSplashPotion extends ItemPotionThrowable {
@Override
public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) {
+ // Paper start
+ InteractionResultWrapper<ItemStack> wrapper = super.a(world, entityhuman, enumhand);
2020-06-26 01:38:24 +02:00
+ 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.RANDOM.nextFloat() * 0.4F + 0.8F));
- return super.a(world, entityhuman, enumhand);
+ }
2019-12-15 19:25:10 +01:00
+ return wrapper;
+ // Paper end
}
}