craftbukkit/nms-patches/net/minecraft/world/item/ItemEnderPearl.patch

23 lines
1.6 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/item/ItemEnderPearl.java
+++ b/net/minecraft/world/item/ItemEnderPearl.java
2025-03-26 03:05:00 +11:00
@@ -24,10 +24,17 @@
2024-10-23 02:15:00 +11:00
public EnumInteractionResult use(World world, EntityHuman entityhuman, EnumHand enumhand) {
2021-11-22 09:00:00 +11:00
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
2025-03-26 03:05:00 +11:00
- world.playSound((Entity) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
2024-10-23 02:15:00 +11:00
if (world instanceof WorldServer worldserver) {
2024-12-04 03:20:00 +11:00
- IProjectile.spawnProjectileFromRotation(EntityEnderPearl::new, worldserver, itemstack, entityhuman, 0.0F, ItemEnderPearl.PROJECTILE_SHOOT_POWER, 1.0F);
2024-10-23 02:15:00 +11:00
+ // CraftBukkit start
2024-12-04 03:20:00 +11:00
+ if (IProjectile.spawnProjectileFromRotation(EntityEnderPearl::new, worldserver, itemstack, entityhuman, 0.0F, ItemEnderPearl.PROJECTILE_SHOOT_POWER, 1.0F).isRemoved()) {
2021-03-16 09:00:00 +11:00
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
2024-10-23 02:15:00 +11:00
+ return EnumInteractionResult.FAIL;
+ }
}
2025-03-26 03:05:00 +11:00
+ world.playSound((Entity) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
+ // CraftBukkit end
2024-10-23 02:15:00 +11:00
2021-11-22 09:00:00 +11:00
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
2024-04-24 01:15:00 +10:00
itemstack.consume(1, entityhuman);