Skip to content

Commit

Permalink
Chickens can retaliate
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Apr 12, 2020
1 parent 95538dd commit e8ec02d
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions patches/server/0125-Chickens-can-retaliate.patch
@@ -0,0 +1,61 @@
From e843c88d0d91a40286f0f30777aac9ad33f09c58 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 12 Apr 2020 13:19:34 -0500
Subject: [PATCH] Chickens can retaliate

---
src/main/java/net/minecraft/server/EntityChicken.java | 11 ++++++++++-
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index 5505b7ee94..b8ea9b3260 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -38,13 +38,22 @@ public class EntityChicken extends EntityAnimal {
protected void initPathfinder() {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
- this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D));
+ //this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D)); // Purpur - moved down
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, false, EntityChicken.bD));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D));
this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
+ // Purpur start
+ if (world.purpurConfig.chickenRetaliate) {
+ this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 1.0D, false));
+ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this));
+ } else {
+ this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D));
+ }
+ // Purpur end
}

@Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index f1cca7219e..ef34a3482e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -381,6 +381,7 @@ public class PurpurWorldConfig {
public boolean chickenDontLayEggsWhenRidden = false;
public int chickenEggsHatchWhenDespawnedMax = 0;
public int chickenEggsHatchWhenDespawnedRange = 10;
+ public boolean chickenRetaliate = false;
private void chickenSettings() {
chickenRidable = getBoolean("mobs.chicken.ridable", chickenRidable);
chickenRidableInWater = getBoolean("mobs.chicken.ridable-in-water", chickenRidableInWater);
@@ -388,6 +389,7 @@ public class PurpurWorldConfig {
chickenDontLayEggsWhenRidden = getBoolean("mobs.chicken.dont-lay-eggs-when-ridden", chickenDontLayEggsWhenRidden);
chickenEggsHatchWhenDespawnedMax = getInt("mobs.chicken.eggs-hatch-when-despawned.max", chickenEggsHatchWhenDespawnedMax);
chickenEggsHatchWhenDespawnedRange = getInt("mobs.chicken.eggs-hatch-when-despawned.range", chickenEggsHatchWhenDespawnedRange);
+ chickenRetaliate = getBoolean("mobs.chicken.retaliate", chickenRetaliate);
}

public boolean codRidable = false;
--
2.24.0

0 comments on commit e8ec02d

Please sign in to comment.