mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Tulips change fox type
This commit is contained in:
@@ -102,6 +102,11 @@ mobs
|
||||
- **default**: true
|
||||
- **description:** When true all valid ender dragon deaths will place an ender egg block on top of the portal
|
||||
|
||||
* fox
|
||||
* tulips-change-type
|
||||
- **default**: true
|
||||
- **description**: Feeding a white/orange tulip changes type snow/regular.
|
||||
|
||||
* giant
|
||||
* naturally-spawn
|
||||
- **default**: true
|
||||
|
||||
97
patches/server/0055-Tulips-change-fox-type.patch
Normal file
97
patches/server/0055-Tulips-change-fox-type.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
From 4c6e788cb3b1158e8955dccd8434939ebe1a026a Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 13 Jul 2019 15:56:22 -0500
|
||||
Subject: [PATCH] Tulips change fox type
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/EntityFox.java | 27 +++++++++++++++++++
|
||||
src/main/java/net/minecraft/server/Items.java | 4 +--
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 ++++
|
||||
3 files changed, 34 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
index 4876289992..dba5894e97 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
@@ -231,6 +231,11 @@ public class EntityFox extends EntityAnimal {
|
||||
}
|
||||
|
||||
private void initializePathFinderGoals() {
|
||||
+ // Purpur start - do not add duplicate goals
|
||||
+ this.targetSelector.a(this.bH);
|
||||
+ this.targetSelector.a(this.bI);
|
||||
+ this.targetSelector.a(this.bJ);
|
||||
+ // Purpur end
|
||||
if (this.getFoxType() == EntityFox.Type.RED) {
|
||||
this.targetSelector.a(4, this.bH);
|
||||
this.targetSelector.a(4, this.bI);
|
||||
@@ -263,6 +268,7 @@ public class EntityFox extends EntityAnimal {
|
||||
|
||||
public void setFoxType(EntityFox.Type entityfox_type) {
|
||||
this.datawatcher.set(EntityFox.bz, entityfox_type.c());
|
||||
+ initializePathFinderGoals(); // Purpur - fix API bug not updating pathfinders on type change
|
||||
}
|
||||
|
||||
private List<UUID> el() {
|
||||
@@ -625,6 +631,27 @@ public class EntityFox extends EntityAnimal {
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
+ @Override
|
||||
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.tulipsChangeFoxType) {
|
||||
+ ItemStack itemstack = entityhuman.b(enumhand);
|
||||
+ if (getFoxType() == Type.RED && itemstack.getItem() == Items.WHITE_TULIP) {
|
||||
+ setFoxType(Type.SNOW);
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack.subtract(1);
|
||||
+ }
|
||||
+ return true;
|
||||
+ } else if (getFoxType() == Type.SNOW && itemstack.getItem() == Items.ORANGE_TULIP) {
|
||||
+ setFoxType(Type.RED);
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack.subtract(1);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return super.a(entityhuman, enumhand);
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public float cX() {
|
||||
return getRider() == null ? super.cX() : 0.5F;
|
||||
diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java
|
||||
index 987297634c..eed256349d 100644
|
||||
--- a/src/main/java/net/minecraft/server/Items.java
|
||||
+++ b/src/main/java/net/minecraft/server/Items.java
|
||||
@@ -106,8 +106,8 @@ public class Items {
|
||||
public static final Item aX = a(Blocks.ALLIUM, CreativeModeTab.c);
|
||||
public static final Item aY = a(Blocks.AZURE_BLUET, CreativeModeTab.c);
|
||||
public static final Item aZ = a(Blocks.RED_TULIP, CreativeModeTab.c);
|
||||
- public static final Item ba = a(Blocks.ORANGE_TULIP, CreativeModeTab.c);
|
||||
- public static final Item bb = a(Blocks.WHITE_TULIP, CreativeModeTab.c);
|
||||
+ public static final Item ba = a(Blocks.ORANGE_TULIP, CreativeModeTab.c); public static final Item ORANGE_TULIP = ba; // Purpur - OBFHELPER
|
||||
+ public static final Item bb = a(Blocks.WHITE_TULIP, CreativeModeTab.c); public static final Item WHITE_TULIP = bb; // Purpur - OBFHELPER
|
||||
public static final Item bc = a(Blocks.PINK_TULIP, CreativeModeTab.c);
|
||||
public static final Item bd = a(Blocks.OXEYE_DAISY, CreativeModeTab.c);
|
||||
public static final Item be = a(Blocks.CORNFLOWER, CreativeModeTab.c);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 8001ecaab5..255b8badc0 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -167,6 +167,11 @@ public class PurpurConfig {
|
||||
feedMushroomsToCows = getInt("settings.mobs.cow.feed-mushrooms-for-mooshroom", feedMushroomsToCows);
|
||||
}
|
||||
|
||||
+ public static boolean tulipsChangeFoxType = true;
|
||||
+ private static void foxSettings() {
|
||||
+ tulipsChangeFoxType = getBoolean("settings.mobs.fox.tulips-change-type", tulipsChangeFoxType);
|
||||
+ }
|
||||
+
|
||||
public static boolean giantsNaturallySpawn = true;
|
||||
public static boolean giantsHaveAI = true;
|
||||
private static void giantsSettings() {
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Reference in New Issue
Block a user