mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 02:17:42 +01:00
six patches
This commit is contained in:
104
patches/server/0033-Breedable-Polar-Bears.patch
Normal file
104
patches/server/0033-Breedable-Polar-Bears.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
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/world/entity/animal/PolarBear.java b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
|
||||
index 0694cd0b994ee595adca43c988485e6dc13c7244..583bb80059b9351d27d15859b1687dd817ba165e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.entity.SpawnGroupData;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
+import net.minecraft.world.entity.ai.goal.BreedGoal;
|
||||
import net.minecraft.world.entity.ai.goal.FloatGoal;
|
||||
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
|
||||
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
|
||||
@@ -39,11 +40,13 @@ import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
|
||||
import net.minecraft.world.entity.ai.goal.PanicGoal;
|
||||
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
|
||||
import net.minecraft.world.entity.ai.goal.RandomStrollGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.TemptGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
@@ -66,6 +69,30 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public boolean canMate(Animal other) {
|
||||
+ if (other == this) {
|
||||
+ return false;
|
||||
+ } else if (this.isStanding()) {
|
||||
+ return false;
|
||||
+ } else if (this.getTarget() != null) {
|
||||
+ return false;
|
||||
+ } else if (!(other instanceof PolarBear)) {
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ PolarBear bear = (PolarBear) other;
|
||||
+ if (bear.isStanding()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (bear.getTarget() != null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return this.isInLove() && bear.isInLove();
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
|
||||
return EntityType.POLAR_BEAR.create(world);
|
||||
@@ -73,7 +100,7 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean isFood(ItemStack stack) {
|
||||
- return false;
|
||||
+ return level.purpurConfig.polarBearBreedableItem != null && stack.getItem() == level.purpurConfig.polarBearBreedableItem; // Purpur;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,6 +109,12 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new PolarBear.PolarBearMeleeAttackGoal());
|
||||
this.goalSelector.addGoal(1, new PolarBear.PolarBearPanicGoal());
|
||||
+ // Purpur start
|
||||
+ if (level.purpurConfig.polarBearBreedableItem != null) {
|
||||
+ this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
|
||||
+ this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, Ingredient.of(level.purpurConfig.polarBearBreedableItem), false));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25D));
|
||||
this.goalSelector.addGoal(5, new RandomStrollGoal(this, 1.0D));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 142135c8058eb3f199f5f7d4572daaac45d997a0..8191eba054e4d47a1310c6d57688d759b909443e 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 = Registry.ITEM.get(new ResourceLocation(polarBearBreedableItemString));
|
||||
+ if (item != Items.AIR) polarBearBreedableItem = item;
|
||||
+ }
|
||||
+
|
||||
public double rabbitNaturalToast = 0.0D;
|
||||
public double rabbitNaturalKiller = 0.0D;
|
||||
private void rabbitSettings() {
|
||||
Reference in New Issue
Block a user