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: PaperMC/Paper@c1bca9a Add exploded block state to BlockExplodeEvent (#6818) PaperMC/Paper@94373f0 Fix OfflinePlayer#getPlayerProfile returning deprecated type (#8543) PaperMC/Paper@7b52db5 Fix buffer-joins-to-world patch PaperMC/Paper@048ee58 Fix OfflinePlayer getPlayerProfile return type (#8710) PaperMC/Paper@e05ba98 Avoid to spam the transform event for hoglin->zoglin conversion (#8712) PaperMC/Paper@8e83c3c Deprecate ProjectileCollideEvent (#8678) PaperMC/Paper@c59922d Expose signed message in chat events (#8694) PaperMC/Paper@5717b84 Add config option for spider worldborder climbing (#6448) PaperMC/Paper@e6f61f7 fix ArmorStandMeta not applying false flags (#8632) PaperMC/Paper@47abd1c Add EntityPushedByEntityEvent (#7704) PaperMC/Paper@f26e9cc Tadpole lock API (#8297) PaperMC/Paper@3331501 Use team display name for quit message (#7127) PaperMC/Paper@1975fbe Respect SpigotConfig logCommands & fix stopDancing() NPE (#8715) PaperMC/Paper@78a91df Fix (again) Player#getPlayerProfile no such method error (#8722) PaperMC/Paper@52718db Updated Upstream (Bukkit/CraftBukkit) (#8714) PaperMC/Paper@2040c1e Player Flying Fall Damage API (#5357)
64 lines
3.0 KiB
Diff
64 lines
3.0 KiB
Diff
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 910bf19c7325180f3121ae3982dddae9e4ea0e97..e8f42ad6cc32cb21584d8988fcf3d1e4b6552f0c 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
|
|
@@ -414,9 +414,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier {
|
|
|
|
@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 ab6c9c87684e1be6276880e847856ee99a0b92a9..d06be7de030dbeb153ec452cf74751642de9c0d8 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1061,10 +1061,13 @@ public class PurpurWorldConfig {
|
|
public boolean allayRidable = false;
|
|
public boolean allayRidableInWater = false;
|
|
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;
|