From 3f17694803e286bcc1818fdb47122fe46e3e4c29 Mon Sep 17 00:00:00 2001 From: Seggan Date: Tue, 9 Nov 2021 03:48:22 -0500 Subject: [PATCH] Goat ram API (#6336) --- patches/api/0345-Goat-ram-API.patch | 23 ++++++++++++++ patches/server/0841-Goat-ram-API.patch | 44 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 patches/api/0345-Goat-ram-API.patch create mode 100644 patches/server/0841-Goat-ram-API.patch diff --git a/patches/api/0345-Goat-ram-API.patch b/patches/api/0345-Goat-ram-API.patch new file mode 100644 index 0000000000..69694887ac --- /dev/null +++ b/patches/api/0345-Goat-ram-API.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Seggan +Date: Thu, 5 Aug 2021 13:10:31 -0400 +Subject: [PATCH] Goat ram API + + +diff --git a/src/main/java/org/bukkit/entity/Goat.java b/src/main/java/org/bukkit/entity/Goat.java +index 90e9028b5ee7fcf9488d37090875b7163bdcd1d0..01827c4118df36fe1b77115f181fb4d225c3c866 100644 +--- a/src/main/java/org/bukkit/entity/Goat.java ++++ b/src/main/java/org/bukkit/entity/Goat.java +@@ -24,4 +24,12 @@ public interface Goat extends Animals { + * @param screaming screaming status + */ + void setScreaming(boolean screaming); ++ ++ // Paper start - Goat ram API ++ /** ++ * Makes the goat ram at the specified entity ++ * @param entity the entity to ram at ++ */ ++ void ram(@org.jetbrains.annotations.NotNull LivingEntity entity); ++ // Paper end + } diff --git a/patches/server/0841-Goat-ram-API.patch b/patches/server/0841-Goat-ram-API.patch new file mode 100644 index 0000000000..8491164ccb --- /dev/null +++ b/patches/server/0841-Goat-ram-API.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Seggan +Date: Thu, 5 Aug 2021 13:10:27 -0400 +Subject: [PATCH] Goat ram API + + +diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +index 32d0387b6c66462ca965add78a562dec3c4b95a9..c7e24da48aaff9fbd1a8272483231744326e3a8e 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java ++++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +@@ -279,6 +279,17 @@ public class Goat extends Animal { + return new Goat.GoatPathNavigation(this, world); + } + ++ // Paper start - Goat ram API ++ public void ram(LivingEntity entity) { ++ Brain brain = this.getBrain(); ++ brain.setMemory(MemoryModuleType.RAM_TARGET, entity.position()); ++ brain.eraseMemory(MemoryModuleType.RAM_COOLDOWN_TICKS); ++ brain.eraseMemory(MemoryModuleType.BREED_TARGET); ++ brain.eraseMemory(MemoryModuleType.TEMPTING_PLAYER); ++ brain.setActiveActivityIfPossible(net.minecraft.world.entity.schedule.Activity.RAM); ++ } ++ // Paper end ++ + private static class GoatPathNavigation extends GroundPathNavigation { + + GoatPathNavigation(Goat goat, Level world) { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java +index ae74df5c9845ac125968a52897f4343b0f348217..436aa41563b8fab112d03c8cc516cf6ff37587bd 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java +@@ -34,4 +34,11 @@ public class CraftGoat extends CraftAnimals implements Goat { + public void setScreaming(boolean screaming) { + this.getHandle().setScreamingGoat(screaming); + } ++ ++ // Paper start - Goat ram API ++ @Override ++ public void ram(@org.jetbrains.annotations.NotNull org.bukkit.entity.LivingEntity entity) { ++ this.getHandle().ram(((CraftLivingEntity) entity).getHandle()); ++ } ++ // Paper end + }