mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@eb0693f Fix EntityDeathEvent cancellation (#9323) PaperMC/Paper@f8cfdd4 Fix SmithingInventory helper slot methods for 1.20 (#9325) PaperMC/Paper@de19eb8 fix incorrectly updated move vector checking patch (#9328) PaperMC/Paper@87dfff4 Implement BossBarViewer on Player (#9332) PaperMC/Paper@2d09115 Use net.kyori.ansi for console logging (#9313) PaperMC/Paper@b48e2e3 Fix dev bundle generation PaperMC/Paper@c287e92 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9301) PaperMC/Paper@2e363c7 1.20.1 (#9333)
This commit is contained in:
63
patches/server/0276-Allay-respect-item-NBT.patch
Normal file
63
patches/server/0276-Allay-respect-item-NBT.patch
Normal file
@@ -0,0 +1,63 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 20 Sep 2022 17:56:21 -0500
|
||||
Subject: [PATCH] Allay respect item NBT
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
index 15c4531865d829ea90d060ee83122a80ab39028b..379d168eb4ba958622398efa79fa43d5340ca0f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -405,9 +405,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
|
||||
@Override
|
||||
public boolean wantsToPickUp(ItemStack stack) {
|
||||
- ItemStack itemstack1 = this.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
-
|
||||
- return !itemstack1.isEmpty() && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.inventory.canAddItem(stack) && this.allayConsidersItemEqual(itemstack1, stack);
|
||||
+ // Purpur start
|
||||
+ if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ ItemStack itemStack = this.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
+ if (itemStack.isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!allayConsidersItemEqual(itemStack, stack)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!this.inventory.canAddItem(stack)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (String tag : this.level().purpurConfig.allayRespectNBT) {
|
||||
+ if (stack.hasTag() && itemStack.hasTag()) {
|
||||
+ Tag tag1 = stack.getTag().get(tag);
|
||||
+ Tag tag2 = itemStack.getTag().get(tag);
|
||||
+ if (!Objects.equals(tag1, tag2)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return true;
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
private boolean allayConsidersItemEqual(ItemStack stack, ItemStack stack2) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index ab4e08fb6613bf0a33ec1ce32847c1e59da274a7..c25cd12a5a6de130a85f6da43cd8f7e75b827e45 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1063,10 +1063,13 @@ public class PurpurWorldConfig {
|
||||
public boolean allayRidable = false;
|
||||
public boolean allayRidableInWater = true;
|
||||
public boolean allayControllable = true;
|
||||
+ public List<String> allayRespectNBT = new ArrayList<>();
|
||||
private void allaySettings() {
|
||||
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
|
||||
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
|
||||
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
|
||||
+ allayRespectNBT.clear();
|
||||
+ getList("mobs.allay.respect-nbt", new ArrayList<>()).forEach(key -> allayRespectNBT.add(key.toString()));
|
||||
}
|
||||
|
||||
public boolean axolotlRidable = false;
|
||||
Reference in New Issue
Block a user