mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: b75eeca0 Boost light task priority to ensure it doesnt hold up chunk loads 3d2bc848 Ensure VillagerTrades doesn't load async - fixes #3495 e470f1ef Add more information to Timing Reports f4a47db6 Improve Thread Pool usage to allow single threads for single cpu servers a4fe910f Fix sounds when using worldedit regen command 70ad51a8 Updated Upstream (Bukkit/CraftBukkit) d7cfa4fa Improve legacy format serialization more
89 lines
4.0 KiB
Diff
89 lines
4.0 KiB
Diff
From 2436ad77c0fa1957dd44c346fc09ced8b1eb7372 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Thu, 26 Mar 2020 19:46:44 -0500
|
|
Subject: [PATCH] Breedable Polar Bears
|
|
|
|
---
|
|
.../net/minecraft/server/EntityPolarBear.java | 30 ++++++++++++++++++-
|
|
.../net/pl3x/purpur/PurpurWorldConfig.java | 5 ++++
|
|
2 files changed, 34 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
index 0a3906bde0..42fef3abaa 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
@@ -32,6 +32,28 @@ public class EntityPolarBear extends EntityAnimal {
|
|
public boolean requireShiftToMount() {
|
|
return world.purpurConfig.polarBearRequireShiftToMount;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean mate(EntityAnimal entityanimal) {
|
|
+ if (entityanimal == this) {
|
|
+ return false;
|
|
+ } else if (this.isStanding()) {
|
|
+ return false;
|
|
+ } else if (this.getGoalTarget() != null) {
|
|
+ return false;
|
|
+ } else if (!(entityanimal instanceof EntityPolarBear)) {
|
|
+ return false;
|
|
+ } else {
|
|
+ EntityPolarBear polarbear = (EntityPolarBear) entityanimal;
|
|
+ if (polarbear.isStanding()) {
|
|
+ return false;
|
|
+ }
|
|
+ if (polarbear.getGoalTarget() != null) {
|
|
+ return false;
|
|
+ }
|
|
+ return this.isInLove() && polarbear.isInLove();
|
|
+ }
|
|
+ }
|
|
// Purpur end
|
|
|
|
@Override
|
|
@@ -41,7 +63,7 @@ public class EntityPolarBear extends EntityAnimal {
|
|
|
|
@Override
|
|
public boolean i(ItemStack itemstack) {
|
|
- return false;
|
|
+ return world.purpurConfig.polarBearBreedableItem != null && itemstack.getItem() == world.purpurConfig.polarBearBreedableItem; // Purpur
|
|
}
|
|
|
|
@Override
|
|
@@ -51,6 +73,12 @@ public class EntityPolarBear extends EntityAnimal {
|
|
this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
|
|
this.goalSelector.a(1, new EntityPolarBear.c());
|
|
this.goalSelector.a(1, new EntityPolarBear.d());
|
|
+ // Purpur start
|
|
+ if (world.purpurConfig.polarBearBreedableItem != null) {
|
|
+ this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
|
|
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, RecipeItemStack.a(world.purpurConfig.polarBearBreedableItem), false));
|
|
+ }
|
|
+ // Purpur end
|
|
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
|
|
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
|
|
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 01b8fffe14..ced9edf827 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -666,10 +666,15 @@ public class PurpurWorldConfig {
|
|
public boolean polarBearRidable = false;
|
|
public boolean polarBearRidableInWater = false;
|
|
public boolean polarBearRequireShiftToMount = true;
|
|
+ public String polarBearBreedableItemString = "";
|
|
+ public Item polarBearBreedableItem = null;
|
|
private void polarBearSettings() {
|
|
polarBearRidable = getBoolean("mobs.polar_bear.ridable", polarBearRidable);
|
|
polarBearRidableInWater = getBoolean("mobs.polar_bear.ridable-in-water", polarBearRidableInWater);
|
|
polarBearRequireShiftToMount = getBoolean("mobs.polar_bear.require-shift-to-mount", polarBearRequireShiftToMount);
|
|
+ polarBearBreedableItemString = getString("mobs.polar_bear.breedable-item", polarBearBreedableItemString);
|
|
+ Item item = IRegistry.ITEM.get(new MinecraftKey(polarBearBreedableItemString));
|
|
+ if (item != Items.AIR) polarBearBreedableItem = item;
|
|
}
|
|
|
|
public boolean pufferfishRidable = false;
|
|
--
|
|
2.24.0
|
|
|