Files
Purpur/patches/server/0197-Breedable-parrots.patch
William Blake Galbreath 635d108ae2 Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
415f7ca165 Updated Upstream (Bukkit/CraftBukkit)
37df95b189 refactor: do not import List; use FQN
5c65546f5c rebase
fdef125b19 Expose EntityType#getTranslationKey
4d9b14efa4 Use AsyncAppender instead of AsyncLoggerContextSelector to keep loggging IO off main thread (#6381)
8c2adf8e9e Add warning to getOfflinePlayers (#6365)
370b60de14 Optimize indirect passenger iteration (#6366)
80836709e7 Fix block drops position losing precision millions of blocks out (#6387)
e942509e73 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6379)
ce43ce8265 Make EntityUnleashEvent cancellable (#4993)
591cac3685 Configurable item frame map cursor interval (#6385)
e9aa9ce66b Add config migration for named entity death logging option (#6390)
c2f47a76ae Implement Translatable in appropriate places (#6248)
f12a7f57e1 Clear bucket NBT after dispense (#6391)
4dd33cb8b6 [ci skip] Drop "Fix CME on adding a passenger in CreatureSpawnEvent" (#6384)
565cd3306c [ci skip] Add some helper methods to the ObfHelper util class (#6374)

Tuinity Changes:
6fd7e2b376 Update paper
2021-08-14 16:40:13 -05:00

72 lines
3.7 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 553b0aff0ccc5baf41d5faae1a2fd88249dd5a74..3da2b68fb03a80676d7a5eed271499f6c4612c61 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -210,6 +210,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(0, new net.pl3x.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));
@@ -324,6 +325,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
}
}
+ 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) {
@@ -349,7 +351,7 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@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, Random random) {
@@ -368,13 +370,13 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index e0e493653c95d6fdf7843efd3f3a7bec4d7729fc..b54dba107a355fe8f4e12f0763fb0b6590788c05 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1399,6 +1399,7 @@ public class PurpurWorldConfig {
public boolean parrotRidableInWater = false;
public double parrotMaxY = 256D;
public double parrotMaxHealth = 6.0D;
+ public boolean parrotBreedable = false;
private void parrotSettings() {
parrotRidable = getBoolean("mobs.parrot.ridable", parrotRidable);
parrotRidableInWater = getBoolean("mobs.parrot.ridable-in-water", parrotRidableInWater);
@@ -1409,6 +1410,7 @@ public class PurpurWorldConfig {
set("mobs.parrot.attributes.max_health", oldValue);
}
parrotMaxHealth = getDouble("mobs.parrot.attributes.max_health", parrotMaxHealth);
+ parrotBreedable = getBoolean("mobs.parrot.can-breed", parrotBreedable);
}
public boolean phantomRidable = false;