From 6197315429fa17a30201029a3c5d7b442dcf95b4 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 5 Nov 2021 17:17:12 -0700 Subject: [PATCH] Add API for checking if a zombie has the option to break doors (#6855) --- build-data/paper.at | 3 +++ patches/api/Zombie-API-breaking-doors.patch | 15 ++++++++++++++- patches/server/Zombie-API-breaking-doors.patch | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/build-data/paper.at b/build-data/paper.at index cb11ee3b6..d259e9a3f 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -246,3 +246,6 @@ public net.minecraft.world.entity.ai.attributes.AttributeSupplier instances # Add ItemFactory#getSpawnEgg API public net.minecraft.world.item.SpawnEggItem BY_ID + +# Zombie API - breaking doors +public net.minecraft.world.entity.monster.Zombie supportsBreakDoorGoal()Z diff --git a/patches/api/Zombie-API-breaking-doors.patch b/patches/api/Zombie-API-breaking-doors.patch index 61aede763..7782dfb50 100644 --- a/patches/api/Zombie-API-breaking-doors.patch +++ b/patches/api/Zombie-API-breaking-doors.patch @@ -21,10 +21,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + boolean canBreakDoors(); + + /** -+ * Sets if this zombie can break doors ++ * Sets if this zombie can break doors. ++ * Check {@link #supportsBreakingDoors()} to see ++ * if this zombie type will even be affected by using ++ * this method. + * + * @param canBreakDoors True if zombie can break doors + */ + void setCanBreakDoors(boolean canBreakDoors); ++ ++ /** ++ * Checks if this zombie type supports breaking doors. ++ * {@link Drowned} do not have support for breaking doors ++ * so using {@link #setCanBreakDoors(boolean)} on them has ++ * no effect. ++ * ++ * @return ++ */ ++ boolean supportsBreakingDoors(); // Paper end } diff --git a/patches/server/Zombie-API-breaking-doors.patch b/patches/server/Zombie-API-breaking-doors.patch index 720a6f283..ba1b613f6 100644 --- a/patches/server/Zombie-API-breaking-doors.patch +++ b/patches/server/Zombie-API-breaking-doors.patch @@ -21,6 +21,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void setCanBreakDoors(boolean canBreakDoors) { + getHandle().setCanBreakDoors(canBreakDoors); ++ } ++ ++ @Override ++ public boolean supportsBreakingDoors() { ++ return getHandle().supportsBreakDoorGoal(); + } // Paper end