From 5d4b4bd35d8051c4fcb2599e3d4ab063b738b5f9 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Fri, 20 Jan 2017 09:01:53 -0600 Subject: [PATCH] Add fromBottle flag to Experience Orbs (#584) * Add fromBottle flag to Experience Orbs --- ...d-fromBottle-flag-to-Experience-Orbs.patch | 21 ++++++ ...d-fromBottle-flag-to-Experience-Orbs.patch | 69 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 Spigot-API-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch create mode 100644 Spigot-Server-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch diff --git a/Spigot-API-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch b/Spigot-API-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch new file mode 100644 index 0000000000..e947dd69db --- /dev/null +++ b/Spigot-API-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 14 Jan 2017 16:15:20 -0600 +Subject: [PATCH] Add fromBottle flag to Experience Orbs + + +diff --git a/src/main/java/org/bukkit/entity/ExperienceOrb.java b/src/main/java/org/bukkit/entity/ExperienceOrb.java +index c286edfd..bcb68fa7 100644 +--- a/src/main/java/org/bukkit/entity/ExperienceOrb.java ++++ b/src/main/java/org/bukkit/entity/ExperienceOrb.java +@@ -0,0 +0,0 @@ public interface ExperienceOrb extends Entity { + * @param value Amount of experience + */ + public void setExperience(int value); ++ ++ /** ++ * Check if this orb was spawned from a ThrownExpBottle ++ */ ++ public boolean isFromBottle(); + } +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch b/Spigot-Server-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch new file mode 100644 index 0000000000..33225a967e --- /dev/null +++ b/Spigot-Server-Patches/Add-fromBottle-flag-to-Experience-Orbs.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 14 Jan 2017 16:15:26 -0600 +Subject: [PATCH] Add fromBottle flag to Experience Orbs + + +diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +index 14431b8a..54c9200a 100644 +--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { + public int value; + private EntityHuman targetPlayer; + private int targetTime; ++ // Paper start ++ private boolean fromBottle = false; ++ ++ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, boolean fromBottle) { ++ this(world, d0, d1, d2, i); ++ this.fromBottle = fromBottle; ++ } ++ // Paper end + + public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) { + super(world); +@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { + this.value = i; + } + ++ // Paper start ++ public boolean isFromBottle() { ++ return fromBottle; ++ } ++ // Paper end ++ + protected boolean playStepSound() { + return false; + } +diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java +index 0255986f..28931295 100644 +--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java ++++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java +@@ -0,0 +0,0 @@ public class EntityThrownExpBottle extends EntityProjectile { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; +- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j)); ++ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j, true)); // Paper - add fromBottle flag + } + + this.die(); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +index 3a09cab3..f992019e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +@@ -0,0 +0,0 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { + getHandle().value = value; + } + ++ // Paper start ++ public boolean isFromBottle() { ++ return getHandle().isFromBottle(); ++ } ++ // Paper end ++ + @Override + public EntityExperienceOrb getHandle() { + return (EntityExperienceOrb) entity; +-- \ No newline at end of file