Files
Purpur/patches/server/0171-Breedable-parrots.patch
granny 67066cdd46 [ci-skip] remove unused config option
not sure why we didn't do this during the 1.19.2 update
2023-03-14 21:56:53 -07:00

72 lines
3.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 13 May 2021 22:17:50 -0500
Subject: [PATCH] Breedable parrots
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
index ab00e8d796ff7c903ea678dedb64cb25cf7e462e..29c13eee52a9f32a07853bd824687601601e3869 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -228,6 +228,7 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D)); // Purpur
+ if (this.level.purpurConfig.parrotBreedable) this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.BreedGoal(this, 1.0D)); // Purpur
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Player.class, 8.0F));
this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this));
this.goalSelector.addGoal(2, new FollowOwnerGoal(this, 1.0D, 5.0F, 1.0F, true));
@@ -342,6 +343,7 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
}
}
+ if (this.level.purpurConfig.parrotBreedable) return super.mobInteract(player, hand); // Purpur
return InteractionResult.sidedSuccess(this.level.isClientSide);
} else if (itemstack.is(Parrot.POISONOUS_FOOD)) {
if (!player.getAbilities().instabuild) {
@@ -367,7 +369,7 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
@Override
public boolean isFood(ItemStack stack) {
- return false;
+ return this.level.purpurConfig.parrotBreedable && Parrot.TAME_FOOD.contains(stack.getItem()); // Purpur
}
public static boolean checkParrotSpawnRules(EntityType<Parrot> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
@@ -384,13 +386,13 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
@Override
public boolean canMate(Animal other) {
- return false;
+ return super.canMate(other); // Purpur
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
- return null;
+ return world.purpurConfig.parrotBreedable ? EntityType.PARROT.create(world) : null; // Purpur
}
@Override
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index ad670766b9f58bfe9db2bbeec42c12097d43e8c8..7aff29c31e5cfc6ea0fc4006195f06ca5aacf7cc 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1568,6 +1568,7 @@ public class PurpurWorldConfig {
public double parrotMaxY = 320D;
public double parrotMaxHealth = 6.0D;
public boolean parrotTakeDamageFromWater = false;
+ public boolean parrotBreedable = false;
private void parrotSettings() {
parrotRidable = getBoolean("mobs.parrot.ridable", parrotRidable);
parrotRidableInWater = getBoolean("mobs.parrot.ridable-in-water", parrotRidableInWater);
@@ -1580,6 +1581,7 @@ public class PurpurWorldConfig {
}
parrotMaxHealth = getDouble("mobs.parrot.attributes.max_health", parrotMaxHealth);
parrotTakeDamageFromWater = getBoolean("mobs.parrot.takes-damage-from-water", parrotTakeDamageFromWater);
+ parrotBreedable = getBoolean("mobs.parrot.can-breed", parrotBreedable);
}
public boolean phantomRidable = false;