2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:24:16 -0600
2023-11-04 20:10:27 +01:00
Subject: [PATCH] Allow nerfed mobs to jump
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
2024-04-25 23:21:18 +02:00
index 2e83e5779d5bdfc150257d3394669d53eba5c5c3..895971f238b693afbf382d9951adb636d1efef2d 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
2024-04-23 23:12:24 +02:00
@@ -126,6 +126,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
2021-06-11 14:02:28 +02:00
private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation;
public GoalSelector goalSelector;
2024-01-24 11:45:17 +01:00
+ @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper - Allow nerfed mobs to jump and float
2021-06-11 14:02:28 +02:00
public GoalSelector targetSelector;
2021-11-23 12:27:39 +01:00
@Nullable
2021-06-11 14:02:28 +02:00
private LivingEntity target;
2024-04-25 23:21:18 +02:00
@@ -935,7 +936,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
2021-06-11 14:02:28 +02:00
@Override
protected final void serverAiStep() {
++this.noActionTime;
- if (!this.aware) return; // CraftBukkit
2023-11-04 20:10:27 +01:00
+ // Paper start - Allow nerfed mobs to jump and float
+ if (!this.aware) {
2021-06-11 14:02:28 +02:00
+ if (goalFloat != null) {
2021-06-17 23:39:36 +02:00
+ if (goalFloat.canUse()) goalFloat.tick();
2021-06-16 19:48:25 +02:00
+ this.getJumpControl().tick();
2021-06-11 14:02:28 +02:00
+ }
+ return;
+ }
2024-01-24 11:45:17 +01:00
+ // Paper end - Allow nerfed mobs to jump and float
2024-04-23 23:12:24 +02:00
ProfilerFiller gameprofilerfiller = this.level().getProfiler();
gameprofilerfiller.push("sensing");
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
2024-04-12 21:14:06 +02:00
index 5fbb5d2bf8945a361babfe50f5f92fa46b9e8b5f..7eb0e0486203d9ad6ce89d17a4da96a7563088a4 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
2021-06-17 23:39:36 +02:00
@@ -9,6 +9,7 @@ public class FloatGoal extends Goal {
2021-06-11 14:02:28 +02:00
public FloatGoal(Mob mob) {
this.mob = mob;
2024-01-24 11:45:17 +01:00
+ if (mob.getCommandSenderWorld().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper - Allow nerfed mobs to jump and float
2021-06-11 14:02:28 +02:00
this.setFlags(EnumSet.of(Goal.Flag.JUMP));
mob.getNavigation().setCanFloat(true);
}