From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Wed, 27 Sep 2023 18:29:51 +0900 Subject: [PATCH] Plazma: Add some missing Pufferfish configurations Original license: MIT Original project: https://github.com/PlazmaMC/PlazmaBukkit Add Pufferfish DAB support for Camel, Sniffer https://github.com/pufferfish-gg/Pufferfish/issues/83 diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java index 9763a5e24e0fed9b49b6ac59911f6c9f8e893db5..b7306bcc60c2986b7f9b054d217a2b8cd76b118e 100644 --- a/net/minecraft/world/entity/animal/HappyGhast.java +++ b/net/minecraft/world/entity/animal/HappyGhast.java @@ -421,9 +421,11 @@ public class HappyGhast extends Animal { return HappyGhastAi.makeBrain(this.brainProvider().makeBrain(dynamic)); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { if (this.isBaby()) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations ((Brain)this.brain).tick(level, this); HappyGhastAi.updateActivity(this); } diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java index b0ce3ab6939cb9e37171bb64e8c5308deb03195e..c520c4e478e3191cea7c2345a2e4c42b67c0762a 100644 --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java @@ -163,8 +163,10 @@ public class Armadillo extends Animal { return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic)); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations ((Brain)this.brain).tick(level, this); ArmadilloAi.updateActivity(this); if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java index 949b6c563658e6e46ac5842d6f088ecae6d4cd0c..c2107133d3def5ef5de7837499d33b5dbf5c20b6 100644 --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java @@ -169,9 +169,11 @@ public class Camel extends AbstractHorse { return pose == Pose.SITTING ? SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose); } + private int behaviorTick = 0; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { Brain brain = this.getBrain(); + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations ((Brain)brain).tick(level, this); CamelAi.updateActivity(this); super.customServerAiStep(level); diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java index a762fc8a4616c4e48e11accdca2129fd47f300e6..08bc21733c08b9df28803b36d3fb17aa3cc29345 100644 --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -493,8 +493,10 @@ public class Sniffer extends Animal { return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations this.getBrain().tick(level, this); SnifferAi.updateActivity(this); super.customServerAiStep(level); diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java index 2a905e8cdf22f9d7f38cc41c1474e80f704d0cb1..385e6d997ea511dd44a7319879baff14addee8bd 100644 --- a/net/minecraft/world/entity/monster/Zoglin.java +++ b/net/minecraft/world/entity/monster/Zoglin.java @@ -285,9 +285,10 @@ public class Zoglin extends Monster implements HoglinBase { this.setAggressive(this.brain.hasMemoryValue(MemoryModuleType.ATTACK_TARGET)); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { - if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Purpur - only use brain if no rider // Leaf - Plazma - Add missing Pufferfish configurations this.getBrain().tick(level, this); this.updateActivity(); } diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java index d91ce14cc39b1b6ccd558f53ed605d4c6a5acae5..52558a99c915da3c46e5f63bd8014cfcdb38505f 100644 --- a/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java @@ -228,8 +228,10 @@ public class Breeze extends Monster { return pos.closerThan(center, 4.0, 10.0); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations this.getBrain().tick(level, this); BreezeAi.updateActivity(this); super.customServerAiStep(level); diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java index 775c11f658b81379784f7e5bdfdc8105b3410480..49f962bbbce22dd26555ee2092ceff96e82aa6b2 100644 --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java @@ -232,8 +232,10 @@ public class Creaking extends Monster { return (Brain)super.getBrain(); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override protected void customServerAiStep(ServerLevel level) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations this.getBrain().tick((ServerLevel)this.level(), this); CreakingAi.updateActivity(this); }