mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
50 patches, around 57 to go
This commit is contained in:
71
patches/server/0186-Breedable-parrots.patch
Normal file
71
patches/server/0186-Breedable-parrots.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
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 953db16af175e14e1a47487659a0346216d8cdbc..5c906b380ad3caceb29fdd5a221cf5ce97910025 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -220,6 +220,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));
|
||||
@@ -334,6 +335,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) {
|
||||
@@ -359,7 +361,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) {
|
||||
@@ -376,13 +378,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 5ea1452da89f2f79fc2e4e912e8b20e3c1e87a4c..4dba5d8c7df8037cafbc4940b6dcb4b9e5087383 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1468,6 +1468,7 @@ public class PurpurWorldConfig {
|
||||
public double parrotMaxY = 256D;
|
||||
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);
|
||||
@@ -1479,6 +1480,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;
|
||||
Reference in New Issue
Block a user