From 6ea4da4a68755295b44db6e877c6f3a9a5c4b62d Mon Sep 17 00:00:00 2001 From: chickeneer Date: Mon, 5 Jul 2021 22:48:08 -0500 Subject: [PATCH] AbstractSkeleton should extend RangedEntity (#6087) This includes Strays and matches the mojang RangedAttackMob --- patches/api/0117-RangedEntity-API.patch | 26 ++++++------- ...n-in-sunlight-API-for-Phantoms-and-S.patch | 4 +- patches/server/0217-RangedEntity-API.patch | 37 ++++++++++++------- ...n-in-sunlight-API-for-Phantoms-and-S.patch | 4 +- 4 files changed, 41 insertions(+), 30 deletions(-) diff --git a/patches/api/0117-RangedEntity-API.patch b/patches/api/0117-RangedEntity-API.patch index c86139036d..05fc6eb809 100644 --- a/patches/api/0117-RangedEntity-API.patch +++ b/patches/api/0117-RangedEntity-API.patch @@ -43,6 +43,19 @@ index 0000000000000000000000000000000000000000..f2e3233a3d1744e32fb76d3731b9858e + return isHandRaised(); + } +} +diff --git a/src/main/java/org/bukkit/entity/AbstractSkeleton.java b/src/main/java/org/bukkit/entity/AbstractSkeleton.java +index e2fce218c6623b3c932c2782a66dea73dccd33f1..4f4f1e48cdaee0d845f60666569e48731be3fbb9 100644 +--- a/src/main/java/org/bukkit/entity/AbstractSkeleton.java ++++ b/src/main/java/org/bukkit/entity/AbstractSkeleton.java +@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull; + * of this type, instanceOf checks against the specific subtypes listed prior + * are recommended. + */ +-public interface AbstractSkeleton extends Monster { ++public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entity.RangedEntity { // Paper + + /** + * Gets the current type of this skeleton. diff --git a/src/main/java/org/bukkit/entity/Drowned.java b/src/main/java/org/bukkit/entity/Drowned.java index 1dee177ae6e21da000607dc8dd8fd76857f323b9..8d1ad9ef757cb1e8d72b145262df73612a76c746 100644 --- a/src/main/java/org/bukkit/entity/Drowned.java @@ -121,19 +134,6 @@ index 9a2252fef56be1ed3ae2169aea46cb567e965c6c..11f38187fca830d974be01fea2966a31 */ -public interface Pillager extends Illager, InventoryHolder { } +public interface Pillager extends Illager, InventoryHolder, RangedEntity { } // Paper -diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java -index 01d838a60d056bf4b4a8ef9d0ac18c6f91f412e6..b7e424ea8a282f45fb8b91c919e4e4526c00be8b 100644 ---- a/src/main/java/org/bukkit/entity/Skeleton.java -+++ b/src/main/java/org/bukkit/entity/Skeleton.java -@@ -7,7 +7,7 @@ package org.bukkit.entity; - * Other skeleton-like entities, such as the {@link WitherSkeleton} or the - * {@link Stray} are not related to this type. - */ --public interface Skeleton extends AbstractSkeleton { -+public interface Skeleton extends AbstractSkeleton, com.destroystokyo.paper.entity.RangedEntity { // Paper - - /** - * Computes whether or not this skeleton is currently in the process of diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java index 818efe2a4d1ac0c4d8dca6c757850d99cdc2cb4b..10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29 100644 --- a/src/main/java/org/bukkit/entity/Snowman.java diff --git a/patches/api/0301-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/0301-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 1f4bc96b56..fd69383d96 100644 --- a/patches/api/0301-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/api/0301-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -30,10 +30,10 @@ index ed4d417c2deefb78807cb61b01df5afcd334d754..a40b045f08b85e22e75459b547e7e7c0 // Paper end } diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java -index b7e424ea8a282f45fb8b91c919e4e4526c00be8b..2ca7c040270fa1b0fe623a0a779879783201a2f1 100644 +index 01d838a60d056bf4b4a8ef9d0ac18c6f91f412e6..6d515726532ad7417fba9d3e01bcb1167539b23c 100644 --- a/src/main/java/org/bukkit/entity/Skeleton.java +++ b/src/main/java/org/bukkit/entity/Skeleton.java -@@ -64,4 +64,19 @@ public interface Skeleton extends AbstractSkeleton, com.destroystokyo.paper.enti +@@ -64,4 +64,19 @@ public interface Skeleton extends AbstractSkeleton { */ STRAY; } diff --git a/patches/server/0217-RangedEntity-API.patch b/patches/server/0217-RangedEntity-API.patch index 28d122dd3a..7773bd986d 100644 --- a/patches/server/0217-RangedEntity-API.patch +++ b/patches/server/0217-RangedEntity-API.patch @@ -45,6 +45,30 @@ index 6c3162606ccf799e99d591da33fd649847db54b8..ad9a8198cec21ab766ad8a274937ecbb + // - see EntitySkeletonAbstract melee goal + void setAggressive(boolean flag); default void setChargingAttack(boolean charging) { setAggressive(charging); }; // Paper } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java +index db6ad6eea8fa6f2755bbb0e1325df8bda98e708a..5ff566186431440c25a26900aba14e4adb642031 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java +@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.entity.AbstractSkeleton; + import org.bukkit.entity.Skeleton; + +-public abstract class CraftAbstractSkeleton extends CraftMonster implements AbstractSkeleton { ++public abstract class CraftAbstractSkeleton extends CraftMonster implements AbstractSkeleton, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper + + public CraftAbstractSkeleton(CraftServer server, net.minecraft.world.entity.monster.AbstractSkeleton entity) { + super(server, entity); +@@ -14,4 +14,10 @@ public abstract class CraftAbstractSkeleton extends CraftMonster implements Abst + public void setSkeletonType(Skeleton.SkeletonType type) { + throw new UnsupportedOperationException("Not supported."); + } ++ // Paper start ++ @Override ++ public net.minecraft.world.entity.monster.AbstractSkeleton getHandle() { ++ return (net.minecraft.world.entity.monster.AbstractSkeleton) super.getHandle(); ++ } ++ // Paper end + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java index 34cb8062168258bfd168826ceeb2fde669f6d1a8..03e2acd4829da449a471b0fa1a311e74aee114d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java @@ -110,19 +134,6 @@ index 06786fba1fef36e8fc3d0f5650160123f728a6d1..beea227855f0b978e655efc298024120 public CraftPillager(CraftServer server, net.minecraft.world.entity.monster.Pillager entity) { super(server, entity); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -index 7a73ada3d8b8085591308275ece4a9ce617314d3..3b19cd5a232f38d373359072925be12f6c075d4a 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; - import org.bukkit.entity.Skeleton; - --public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton { -+public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper - - public CraftSkeleton(CraftServer server, net.minecraft.world.entity.monster.Skeleton entity) { - super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java index 6a82d567d96a42bfea0e38afb4e8de13eb3ad5a2..659e2959c5330e4764ea1edc7f8de9f464f9ff52 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java diff --git a/patches/server/0679-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0679-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 7acddd3981..cdd199342c 100644 --- a/patches/server/0679-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/0679-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -110,10 +110,10 @@ index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d0 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -index 3b19cd5a232f38d373359072925be12f6c075d4a..a248774ead0afee576af291e70a9a05d12ca203b 100644 +index 7a73ada3d8b8085591308275ece4a9ce617314d3..823e922a049719c4cfd57b0108df3bc2144d9975 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton, co +@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton { public SkeletonType getSkeletonType() { return SkeletonType.NORMAL; }