Creeper encircle target (#1162)

Co-authored-by: granny <granny@purpurmc.org>
This commit is contained in:
Jared Seville
2022-10-25 01:57:47 -07:00
committed by GitHub
parent 20b745d96a
commit 4a8c2da130

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jared Seville <Peashooter101@yahoo.com>
Date: Sat, 15 Oct 2022 16:01:03 -0700
Subject: [PATCH] Add option to allow creeper to encircle target when fusing.
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java
index 8562cbfa258499bc04e5ffbcb4402dfc78ed20c3..00c89879a4f679d814cb5c381e57bc4d3dc5323b 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java
@@ -54,6 +54,14 @@ public class SwellGoal extends Goal {
this.creeper.setSwellDir(-1);
} else {
this.creeper.setSwellDir(1);
+ // Purpur start
+ if (this.creeper.getLevel().purpurConfig.creeperEncircleTarget) {
+ net.minecraft.world.phys.Vec3 relative = this.creeper.position().subtract(this.target.position());
+ relative = relative.yRot((float) Math.PI / 3).normalize().multiply(2, 2, 2);
+ net.minecraft.world.phys.Vec3 destination = this.target.position().add(relative);
+ this.creeper.getNavigation().moveTo(destination.x, destination.y, destination.z, 1);
+ }
+ // Purpur end
}
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 33d7c132b19095598eb681da8487a072f1dccab6..c7f0fba9d3d5415e7965501774feaf12d7b1b3a6 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1291,6 +1291,7 @@ public class PurpurWorldConfig {
public boolean creeperHealthRadius = false;
public boolean creeperAlwaysDropExp = false;
public double creeperHeadVisibilityPercent = 0.5D;
+ public boolean creeperEncircleTarget = false;
private void creeperSettings() {
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
@@ -1309,6 +1310,7 @@ public class PurpurWorldConfig {
creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius);
creeperAlwaysDropExp = getBoolean("mobs.creeper.always-drop-exp", creeperAlwaysDropExp);
creeperHeadVisibilityPercent = getDouble("mobs.creeper.head-visibility-percent", creeperHeadVisibilityPercent);
+ creeperEncircleTarget = getBoolean("mobs.creeper.creeper-encircle-target", creeperEncircleTarget);
}
public boolean dolphinRidable = false;