From 2d8592203b900c1251b81de020addce3f984ae74 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 31 Dec 2022 10:24:09 +1100 Subject: [PATCH] SPIGOT-7221: Add Enemy (Entity) interface By: ShaneBee --- .../org/bukkit/craftbukkit/entity/CraftEnderDragon.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftEnemy.java | 9 +++++++++ .../java/org/bukkit/craftbukkit/entity/CraftGhast.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftHoglin.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftMonster.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftPhantom.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftShulker.java | 2 +- .../java/org/bukkit/craftbukkit/entity/CraftSlime.java | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnemy.java diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java index 0ac107f0e3..b81907b45b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -15,7 +15,7 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon.Phase; import org.bukkit.entity.EntityType; -public class CraftEnderDragon extends CraftMob implements EnderDragon { +public class CraftEnderDragon extends CraftMob implements EnderDragon, CraftEnemy { public CraftEnderDragon(CraftServer server, EntityEnderDragon entity) { super(server, entity); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnemy.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnemy.java new file mode 100644 index 0000000000..f17df43884 --- /dev/null +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEnemy.java @@ -0,0 +1,9 @@ +package org.bukkit.craftbukkit.entity; + +import net.minecraft.world.entity.monster.IMonster; +import org.bukkit.entity.Enemy; + +public interface CraftEnemy extends Enemy { + + IMonster getHandle(); +} diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java index fb17b40ff8..ed47774fb8 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java @@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Ghast; -public class CraftGhast extends CraftFlying implements Ghast { +public class CraftGhast extends CraftFlying implements Ghast, CraftEnemy { public CraftGhast(CraftServer server, EntityGhast entity) { super(server, entity); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java index e5284f6e76..4ecfed1136 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java @@ -6,7 +6,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Hoglin; -public class CraftHoglin extends CraftAnimals implements Hoglin { +public class CraftHoglin extends CraftAnimals implements Hoglin, CraftEnemy { public CraftHoglin(CraftServer server, EntityHoglin entity) { super(server, entity); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java index b7378d6d03..dd3ef68954 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java @@ -4,7 +4,7 @@ import net.minecraft.world.entity.monster.EntityMonster; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Monster; -public class CraftMonster extends CraftCreature implements Monster { +public class CraftMonster extends CraftCreature implements Monster, CraftEnemy { public CraftMonster(CraftServer server, EntityMonster entity) { super(server, entity); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java index 25e52ae24c..be2047c9d7 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java @@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Phantom; -public class CraftPhantom extends CraftFlying implements Phantom { +public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy { public CraftPhantom(CraftServer server, EntityPhantom entity) { super(server, entity); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java index 65ff12b412..e05bef5be3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java @@ -9,7 +9,7 @@ import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.entity.EntityType; import org.bukkit.entity.Shulker; -public class CraftShulker extends CraftGolem implements Shulker { +public class CraftShulker extends CraftGolem implements Shulker, CraftEnemy { public CraftShulker(CraftServer server, EntityShulker entity) { super(server, entity); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index aa0ac8d849..cc09534dd0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Slime; -public class CraftSlime extends CraftMob implements Slime { +public class CraftSlime extends CraftMob implements Slime, CraftEnemy { public CraftSlime(CraftServer server, EntitySlime entity) { super(server, entity);