mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Tulips change fox type
This commit is contained in:
committed by
granny
parent
d4fb8de6de
commit
fe5fcdab1b
@@ -1,80 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Fox.java b/net/minecraft/world/entity/animal/Fox.java
|
||||
index 584d08bca961f8b8487b844cd2412b773401296d..a0adc29bb09a3eaecdaf564fd992b8aefec69629 100644
|
||||
--- a/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -385,6 +385,11 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
}
|
||||
|
||||
private void setTargetGoals() {
|
||||
+ // Purpur start - do not add duplicate goals
|
||||
+ this.targetSelector.removeGoal(this.landTargetGoal);
|
||||
+ this.targetSelector.removeGoal(this.turtleEggTargetGoal);
|
||||
+ this.targetSelector.removeGoal(this.fishTargetGoal);
|
||||
+ // Purpur end
|
||||
if (this.getVariant() == Fox.Variant.RED) {
|
||||
this.targetSelector.addGoal(4, this.landTargetGoal);
|
||||
this.targetSelector.addGoal(4, this.turtleEggTargetGoal);
|
||||
@@ -414,6 +419,7 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
|
||||
public void setVariant(Fox.Variant variant) {
|
||||
this.entityData.set(Fox.DATA_TYPE_ID, variant.getId());
|
||||
+ this.setTargetGoals(); // Purpur - fix API bug not updating pathfinders on type change
|
||||
}
|
||||
|
||||
List<UUID> getTrustedUUIDs() {
|
||||
@@ -749,6 +755,29 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public net.minecraft.world.InteractionResult mobInteract(Player player, net.minecraft.world.InteractionHand hand) {
|
||||
+ if (level().purpurConfig.foxTypeChangesWithTulips) {
|
||||
+ ItemStack itemstack = player.getItemInHand(hand);
|
||||
+ if (getVariant() == Variant.RED && itemstack.getItem() == Items.WHITE_TULIP) {
|
||||
+ setVariant(Variant.SNOW);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ } else if (getVariant() == Variant.SNOW && itemstack.getItem() == Items.ORANGE_TULIP) {
|
||||
+ setVariant(Variant.RED);
|
||||
+ if (!player.getAbilities().instabuild) {
|
||||
+ itemstack.shrink(1);
|
||||
+ }
|
||||
+ return net.minecraft.world.InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+ return super.mobInteract(player, hand);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
// Paper start - Cancellable death event
|
||||
protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 0ba770af96809403dd93317dcf5120c7d87bf587..37f89fabc286ea07bf6438df7ed7c8d6bcb76d48 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -586,6 +586,7 @@ public class PurpurWorldConfig {
|
||||
public boolean foxControllable = true;
|
||||
public double foxMaxHealth = 10.0D;
|
||||
public double foxScale = 1.0D;
|
||||
+ public boolean foxTypeChangesWithTulips = false;
|
||||
private void foxSettings() {
|
||||
foxRidable = getBoolean("mobs.fox.ridable", foxRidable);
|
||||
foxRidableInWater = getBoolean("mobs.fox.ridable-in-water", foxRidableInWater);
|
||||
@@ -597,6 +598,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
foxMaxHealth = getDouble("mobs.fox.attributes.max_health", foxMaxHealth);
|
||||
foxScale = Mth.clamp(getDouble("mobs.fox.attributes.scale", foxScale), 0.0625D, 16.0D);
|
||||
+ foxTypeChangesWithTulips = getBoolean("mobs.fox.tulips-change-type", foxTypeChangesWithTulips);
|
||||
}
|
||||
|
||||
public boolean frogRidable = false;
|
||||
Reference in New Issue
Block a user