Paper/patches/server/0022-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
MiniDigger | Martin 1ebaffacf5 some compile fixes
2023-09-22 19:31:02 +02:00

50 Zeilen
2.4 KiB
Diff

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
Subject: [PATCH] Allow nerfed mobs to jump and take water damage
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index ec841a4d9a11f0d9047c202a31f944b340da33c8..ffd8b35b606452ce5d189f2761aa76eb9b56ccd6 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -111,6 +111,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation;
public GoalSelector goalSelector;
+ @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper
public GoalSelector targetSelector;
@Nullable
private LivingEntity target;
@@ -876,7 +877,17 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override
protected final void serverAiStep() {
++this.noActionTime;
- if (!this.aware) return; // CraftBukkit
+ if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
+ if (goalFloat != null) {
+ if (goalFloat.canUse()) goalFloat.tick();
+ this.getJumpControl().tick();
+ }
+ if (this.isSensitiveToWater() && isInWaterRainOrBubble()) {
+ hurt(this.damageSources().drown(), 1.0F);
+ }
+ return;
+ }
+ // Paper end
this.level().getProfiler().push("sensing");
this.sensing.tick();
this.level().getProfiler().pop();
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
index f2086bce2d95b5b1f422add74b3dff4fe6dbac8c..7435a45ae2787ab7c17fc853f567fc20b59b7f76 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
@@ -9,6 +9,7 @@ public class FloatGoal extends Goal {
public FloatGoal(Mob mob) {
this.mob = mob;
+ if (mob.getCommandSenderWorld().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper
this.setFlags(EnumSet.of(Goal.Flag.JUMP));
mob.getNavigation().setCanFloat(true);
}