mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 0514fc4e2 Add missing effects 8f5d9effd Add getMainThreadExecutor to BukkitScheduler 313b5020b Allow adding items to BlockDropItemEvent (#5093) 9a556d9da [CI-SKIP] [Auto] Rebuild Patches 72b2768ad Inline shift fields in EnumDirection (#5082) ffff53fa7 added option to disable pathfinding updates on block changes (#5123) b67081fd7 add DragonEggFormEvent (fixes #5110) (#5112) 3eefafbaf Fix javadoc build 0081ed1c4 Add javadoc step to GH Actions 01082503e Add dropLeash variable to EntityUnleashEvent (#5130) 31f9f869a [CI-SKIP] Fix YourKit links in readme, fixes #5091 8ac27aa38 [Auto] Updated Upstream (CraftBukkit) c4d9cc831 [Auto] Updated Upstream (Bukkit/CraftBukkit) d0477d326 [Auto] Updated Upstream (CraftBukkit) d9f5f7018 EntityMoveEvent (#4614)
96 lines
4.3 KiB
Diff
96 lines
4.3 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 914c6e48d60ac8feadc08e52e050899fe1396a8d..99f0bd8f82520778d469ec51745034e6ebd3238a 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 459ff8ffe7c0bf09fe93d89b3433bc930bb52f06..09b66b9ca3185528d0bc5f0a1d811c5a42039339 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -164,6 +164,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() {
|