diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/EnderpearlItem.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/item/EnderpearlItem.java.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/EnderpearlItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/EnderpearlItem.java.patch new file mode 100644 index 0000000000..2a4701dc4e --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/EnderpearlItem.java.patch @@ -0,0 +1,55 @@ +--- a/net/minecraft/world/item/EnderpearlItem.java ++++ b/net/minecraft/world/item/EnderpearlItem.java +@@ -3,7 +3,7 @@ + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.stats.Stats; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResultHolder; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.entity.projectile.ThrownEnderpearl; +@@ -11,25 +11,32 @@ + + public class EnderpearlItem extends Item { + +- public EnderpearlItem(Item.Properties item_properties) { +- super(item_properties); ++ public EnderpearlItem(Item.Properties properties) { ++ super(properties); + } + + @Override +- @Override +- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionhand) { +- ItemStack itemstack = player.getItemInHand(interactionhand); ++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); + +- level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); +- player.getCooldowns().addCooldown(this, 20); ++ // CraftBukkit start - change order + if (!level.isClientSide) { +- ThrownEnderpearl thrownenderpearl = new ThrownEnderpearl(level, player); ++ ThrownEnderpearl entityenderpearl = new ThrownEnderpearl(level, player); + +- thrownenderpearl.setItem(itemstack); +- thrownenderpearl.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); +- level.addFreshEntity(thrownenderpearl); ++ entityenderpearl.setItem(itemstack); ++ entityenderpearl.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); ++ if (!level.addFreshEntity(entityenderpearl)) { ++ if (player instanceof net.minecraft.server.level.ServerPlayer) { ++ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().updateInventory(); ++ } ++ return InteractionResultHolder.fail(itemstack); ++ } + } + ++ level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); ++ player.getCooldowns().addCooldown(this, 20); ++ // CraftBukkit end ++ + player.awardStat(Stats.ITEM_USED.get(this)); + if (!player.getAbilities().instabuild) { + itemstack.shrink(1); |