option to make ravagers afraid of rabbits

https://github.com/PurpurMC/Purpur/discussions/713
This commit is contained in:
granny
2025-01-12 18:04:06 -08:00
committed by granny
parent c935de147d
commit 194d9685b2
3 changed files with 10 additions and 39 deletions

View File

@@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <granny@purpurmc.org>
Date: Tue, 7 May 2024 04:59:57 -0700
Subject: [PATCH] option to make ravagers afraid of rabbits
https://github.com/PurpurMC/Purpur/discussions/713
diff --git a/net/minecraft/world/entity/monster/Ravager.java b/net/minecraft/world/entity/monster/Ravager.java
index 95562e3614880702655df4578119e6cf3702e566..a5134a80a707bc69ae5826eae89e79be5ec3fa41 100644
--- a/net/minecraft/world/entity/monster/Ravager.java
+++ b/net/minecraft/world/entity/monster/Ravager.java
@@ -122,6 +122,7 @@ public class Ravager extends Raider {
super.registerGoals();
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
+ if (level().purpurConfig.ravagerAvoidRabbits) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.AvoidEntityGoal<>(this, net.minecraft.world.entity.animal.Rabbit.class, 6.0F, 1.0D, 1.2D)); // Purpur - option to make ravagers afraid of rabbits
this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, true));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4D));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index eb3d81c9eb9a332fd39382d28d022395d9aa4390..0d5a0e14cbaacc63eeced78a6c28cc64ad918522 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -2494,6 +2494,7 @@ public class PurpurWorldConfig {
public boolean ravagerTakeDamageFromWater = false;
public List<Block> ravagerGriefableBlocks = new ArrayList<>();
public boolean ravagerAlwaysDropExp = false;
+ public boolean ravagerAvoidRabbits = false;
private void ravagerSettings() {
ravagerRidable = getBoolean("mobs.ravager.ridable", ravagerRidable);
ravagerRidableInWater = getBoolean("mobs.ravager.ridable-in-water", ravagerRidableInWater);
@@ -2525,6 +2526,7 @@ public class PurpurWorldConfig {
}
});
ravagerAlwaysDropExp = getBoolean("mobs.ravager.always-drop-exp", ravagerAlwaysDropExp);
+ ravagerAvoidRabbits = getBoolean("mobs.ravager.avoid-rabbits", ravagerAvoidRabbits);
}
public boolean salmonRidable = false;