From 5a20cbd75926abd642e961ffddb8723ad6f66731 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sun, 23 Aug 2020 15:29:02 +0200 Subject: [PATCH] Add more Evoker API --- .../0223-Add-more-Evoker-API.patch | 30 +++++++++++ .../0573-Add-more-Evoker-API.patch | 50 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 Spigot-API-Patches/0223-Add-more-Evoker-API.patch create mode 100644 Spigot-Server-Patches/0573-Add-more-Evoker-API.patch diff --git a/Spigot-API-Patches/0223-Add-more-Evoker-API.patch b/Spigot-API-Patches/0223-Add-more-Evoker-API.patch new file mode 100644 index 0000000000..0d6f0f7328 --- /dev/null +++ b/Spigot-API-Patches/0223-Add-more-Evoker-API.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 15:22:44 +0200 +Subject: [PATCH] Add more Evoker API + + +diff --git a/src/main/java/org/bukkit/entity/Evoker.java b/src/main/java/org/bukkit/entity/Evoker.java +index f8d173adc09197418883dc7bc66dd8bfff8c5c72..76f81cd124090337876c9e5e469862a1c8da4ec8 100644 +--- a/src/main/java/org/bukkit/entity/Evoker.java ++++ b/src/main/java/org/bukkit/entity/Evoker.java +@@ -64,4 +64,19 @@ public interface Evoker extends Spellcaster { + */ + @Deprecated + void setCurrentSpell(@Nullable Spell spell); ++ ++ // Paper start ++ /** ++ * @return the sheep being targeted by the {@link Spell#WOLOLO wololo spell}, or {@code null} if none ++ */ ++ @Nullable ++ Sheep getWololoTarget(); ++ ++ /** ++ * Set the sheep to be the target of the {@link Spell#WOLOLO wololo spell}, or {@code null} to clear. ++ * ++ * @param sheep new wololo target ++ */ ++ void setWololoTarget(@Nullable Sheep sheep); ++ // Paper end + } diff --git a/Spigot-Server-Patches/0573-Add-more-Evoker-API.patch b/Spigot-Server-Patches/0573-Add-more-Evoker-API.patch new file mode 100644 index 0000000000..f68d7f471c --- /dev/null +++ b/Spigot-Server-Patches/0573-Add-more-Evoker-API.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 15:28:35 +0200 +Subject: [PATCH] Add more Evoker API + + +diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java +index 307d723c92d2b165665ef88055d5874dbf57e078..9f3922b18ef9b0b75b1b00f5d5e9828d062e19a9 100644 +--- a/src/main/java/net/minecraft/server/EntityEvoker.java ++++ b/src/main/java/net/minecraft/server/EntityEvoker.java +@@ -5,7 +5,7 @@ import javax.annotation.Nullable; + + public class EntityEvoker extends EntityIllagerWizard { + +- private EntitySheep bo; ++ private EntitySheep bo; public final EntitySheep getWololoTarget() { return this.bo; } public final void setWololoTarget(EntitySheep sheep) { this.bo = sheep; } // Paper - OBFHELPER + + public EntityEvoker(EntityTypes entitytypes, World world) { + super(entitytypes, world); +@@ -24,7 +24,7 @@ public class EntityEvoker extends EntityIllagerWizard { + this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D)); + this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F)); + this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F)); +- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a()); ++ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // Paper - decompile fix + this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).a(300)); + this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, false)); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java +index 0636d264731f1f346360ffecb4271b5e561b8eaf..bc397f34f3d0819b9568322872e0238ef8fd22a7 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java +@@ -36,4 +36,17 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker { + public void setCurrentSpell(Evoker.Spell spell) { + getHandle().setSpell(spell == null ? EntityIllagerWizard.Spell.NONE : EntityIllagerWizard.Spell.a(spell.ordinal())); + } ++ ++ // Paper start ++ @Override ++ public org.bukkit.entity.Sheep getWololoTarget() { ++ net.minecraft.server.EntitySheep sheep = getHandle().getWololoTarget(); ++ return sheep == null ? null : (org.bukkit.entity.Sheep) sheep.getBukkitEntity(); ++ } ++ ++ @Override ++ public void setWololoTarget(org.bukkit.entity.Sheep sheep) { ++ getHandle().setWololoTarget(sheep == null ? null : ((org.bukkit.craftbukkit.entity.CraftSheep) sheep).getHandle()); ++ } ++ // Paper end + }