mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 17:07:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 9a129fa99 Add #getEligibleHumans to SkeletonHorseTrapEvent b5e23c7a6 Fix merging spawning values a932e8ad7 Turn off spigot verbose world by default 8ced89f65 Fix Delegation to vanilla chunk gen
96 lines
4.2 KiB
Diff
96 lines
4.2 KiB
Diff
From 0000000000000000000000000000000000000000 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
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
index 914c6e48d6..99f0bd8f82 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
@@ -23,6 +23,30 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable {
|
|
super(entitytypes, world);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @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
|
|
public EntityAgeable createChild(WorldServer worldserver, EntityAgeable entityageable) {
|
|
return (EntityAgeable) EntityTypes.POLAR_BEAR.a((World) worldserver);
|
|
@@ -30,7 +54,7 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable {
|
|
|
|
@Override
|
|
public boolean k(ItemStack itemstack) {
|
|
- return false;
|
|
+ return world.purpurConfig.polarBearBreedableItem != null && itemstack.getItem() == world.purpurConfig.polarBearBreedableItem; // Purpur;
|
|
}
|
|
|
|
@Override
|
|
@@ -39,6 +63,12 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable {
|
|
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
|
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));
|
|
@@ -180,10 +210,12 @@ public class EntityPolarBear extends EntityAnimal implements IEntityAngerable {
|
|
return flag;
|
|
}
|
|
|
|
+ public boolean isStanding() { return eM(); } // Purpur - OBFHELPER
|
|
public boolean eM() {
|
|
return (Boolean) this.datawatcher.get(EntityPolarBear.bo);
|
|
}
|
|
|
|
+ public void setStanding(boolean standing) { t(standing); } // Purpur - OBFHELPER
|
|
public void t(boolean flag) {
|
|
this.datawatcher.set(EntityPolarBear.bo, flag);
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 40bc4cc77b..882ac4c1f6 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -154,6 +154,14 @@ public class PurpurWorldConfig {
|
|
ironGolemCanSwim = getBoolean("mobs.iron_golem.can-swim", ironGolemCanSwim);
|
|
}
|
|
|
|
+ public String polarBearBreedableItemString = "";
|
|
+ public Item polarBearBreedableItem = null;
|
|
+ private void polarBearSettings() {
|
|
+ polarBearBreedableItemString = getString("mobs.polar_bear.breedable-item", polarBearBreedableItemString);
|
|
+ Item item = IRegistry.ITEM.get(new MinecraftKey(polarBearBreedableItemString));
|
|
+ if (item != Items.AIR) polarBearBreedableItem = item;
|
|
+ }
|
|
+
|
|
public double rabbitNaturalToast = 0.0D;
|
|
public double rabbitNaturalKiller = 0.0D;
|
|
private void rabbitSettings() {
|