mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 01:47:42 +01:00
port Chickens can retaliate patch
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Chicken.java b/net/minecraft/world/entity/animal/Chicken.java
|
||||
index 509163f409a5b8988a484aedb2f3ddf042d5eb13..d718f0ed362c49803260dceed64bd93e2b6744fc 100644
|
||||
--- a/net/minecraft/world/entity/animal/Chicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/Chicken.java
|
||||
@@ -73,6 +73,11 @@ public class Chicken extends Animal {
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.chickenMaxHealth);
|
||||
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.chickenScale);
|
||||
+ // Purpur start - Chickens can retaliate
|
||||
+ if (level().purpurConfig.chickenRetaliate) {
|
||||
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(2.0D);
|
||||
+ }
|
||||
+ // Purpur end - Chickens can retaliate
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -80,13 +85,21 @@ public class Chicken extends Animal {
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
- this.goalSelector.addGoal(1, new PanicGoal(this, 1.4));
|
||||
+ //this.goalSelector.addGoal(1, new PanicGoal(this, 1.4)); // Purpur - Chickens can retaliate - moved down
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(3, new TemptGoal(this, 1.0, itemStack -> itemStack.is(ItemTags.CHICKEN_FOOD), false));
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
|
||||
+ // Purpur start - Chickens can retaliate
|
||||
+ if (level().purpurConfig.chickenRetaliate) {
|
||||
+ this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.0D, false));
|
||||
+ this.targetSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal(this));
|
||||
+ } else {
|
||||
+ this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
|
||||
+ }
|
||||
+ // Purpur end - Chickens can retaliate
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +108,7 @@ public class Chicken extends Animal {
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
- return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.25);
|
||||
+ return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 4.0).add(Attributes.MOVEMENT_SPEED, 0.25).add(Attributes.ATTACK_DAMAGE, 0.0D); // Purpur - Chickens can retaliate
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -329,6 +329,7 @@ public class PurpurWorldConfig {
|
||||
public boolean chickenControllable = true;
|
||||
public double chickenMaxHealth = 4.0D;
|
||||
public double chickenScale = 1.0D;
|
||||
public boolean chickenRetaliate = false;
|
||||
private void chickenSettings() {
|
||||
chickenRidable = getBoolean("mobs.chicken.ridable", chickenRidable);
|
||||
chickenRidableInWater = getBoolean("mobs.chicken.ridable-in-water", chickenRidableInWater);
|
||||
@@ -340,6 +341,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
chickenMaxHealth = getDouble("mobs.chicken.attributes.max_health", chickenMaxHealth);
|
||||
chickenScale = Mth.clamp(getDouble("mobs.chicken.attributes.scale", chickenScale), 0.0625D, 16.0D);
|
||||
chickenRetaliate = getBoolean("mobs.chicken.retaliate", chickenRetaliate);
|
||||
}
|
||||
|
||||
public boolean codRidable = false;
|
||||
|
||||
Reference in New Issue
Block a user