From bb6a5d8612bd9a57f307fcc8a0891e76a3ac85c2 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 2 Aug 2018 09:38:52 +1000 Subject: [PATCH] SPIGOT-4199: Riptide related APIs By: md_5 --- paper-server/nms-patches/ItemTrident.patch | 27 +++++++++++++++++++ .../craftbukkit/entity/CraftLivingEntity.java | 5 ++++ 2 files changed, 32 insertions(+) create mode 100644 paper-server/nms-patches/ItemTrident.patch diff --git a/paper-server/nms-patches/ItemTrident.patch b/paper-server/nms-patches/ItemTrident.patch new file mode 100644 index 0000000000..7de03dd633 --- /dev/null +++ b/paper-server/nms-patches/ItemTrident.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/server/ItemTrident.java ++++ b/net/minecraft/server/ItemTrident.java +@@ -6,9 +6,13 @@ + + public ItemTrident(Item.Info item_info) { + super(item_info); ++ // CraftBukkit start - obfuscator went a little crazy ++ /* + this.a(new MinecraftKey("throwing"), (itemstack, world, entityliving) -> { + return entityliving != null && entityliving.isHandRaised() && entityliving.cW() == itemstack ? 1.0F : 0.0F; + }); ++ */ ++ // CraftBukkit end + } + + public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) { +@@ -53,6 +57,10 @@ + SoundEffect soundeffect = SoundEffects.ITEM_TRIDENT_THROW; + + if (k > 0) { ++ // CraftBukkit start ++ org.bukkit.event.player.PlayerRiptideEvent event = new org.bukkit.event.player.PlayerRiptideEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); ++ event.getPlayer().getServer().getPluginManager().callEvent(event); ++ // CraftBukkit end + float f = entityhuman.yaw; + float f1 = entityhuman.pitch; + float f2 = -MathHelper.sin(f * 0.017453292F) * MathHelper.cos(f1 * 0.017453292F); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index ae402a2bf4..0a3733b2fd 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -478,6 +478,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { getHandle().setSwimming(swimming); } + @Override + public boolean isRiptiding() { + return getHandle().cO(); + } + @Override public AttributeInstance getAttribute(Attribute attribute) { return getHandle().craftAttributes.getAttribute(attribute);