Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow anvil destroy item entities and disable vault blacklist #364

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions patches/server/0006-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ index d97771ecaf06b92d92b5ca0224ae0866e36703a6..439305bb4f5ce232aa6237276c121d53
.withRequiredArg()
diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..eced5c887f83602e1050f42de2789266478c70d0
index 0000000000000000000000000000000000000000..313beaa7eef481bfc42d89959e227dac6558fab9
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,895 @@
@@ -0,0 +1,901 @@
+package org.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand Down Expand Up @@ -329,6 +329,9 @@ index 0000000000000000000000000000000000000000..eced5c887f83602e1050f42de2789266
+ @GlobalConfig(name = "give-bad-omen-when-kill-patrol-leader", category = {"modify", "minecraft-old", "revert-raid-changes"})
+ public static boolean giveBadOmenWhenKillPatrolLeader = false;
+
+ @GlobalConfig(name = "allow-anvil-destroy-item-entities", category = {"modify", "minecraft-old"})
+ public static boolean allowAnvilDestroyItemEntities = false;
+
+ // Leaves end - modify - minecraft-old
+
+ // Leaves start - modify - elytra-aeronautics
Expand Down Expand Up @@ -579,6 +582,9 @@ index 0000000000000000000000000000000000000000..eced5c887f83602e1050f42de2789266
+ }
+ }
+
+ @GlobalConfig(name = "disable-vault-blacklist", category = "modify")
+ public static boolean disableVaultBlacklist = false;
+
+ @RemovedConfig(name = "tick-command", category = "modify")
+ @RemovedConfig(name = "player-can-edit-sign", category = "modify")
+ @RemovedConfig(name = "mending-compatibility-infinity", category = {"modify", "minecraft-old"})
Expand Down
19 changes: 19 additions & 0 deletions patches/server/0134-Allow-anvil-destroy-item-entities.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: huanli233 <392352840@qq.com>
Date: Sat, 26 Oct 2024 19:53:17 +0800
Subject: [PATCH] Allow anvil destroy item entities


diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index e38f588e3043320a9c135e03f506a00924ed58b8..5e91b222f9e6e908071d7b21a3fb782fa52eddab 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -275,7 +275,7 @@ public class FallingBlockEntity extends Entity {
if (i < 0) {
return false;
} else {
- Predicate<Entity> predicate = EntitySelector.NO_CREATIVE_OR_SPECTATOR.and(EntitySelector.LIVING_ENTITY_STILL_ALIVE);
+ Predicate<Entity> predicate = org.leavesmc.leaves.LeavesConfig.allowAnvilDestroyItemEntities ? EntitySelector.NO_CREATIVE_OR_SPECTATOR : EntitySelector.NO_CREATIVE_OR_SPECTATOR.and(EntitySelector.LIVING_ENTITY_STILL_ALIVE); // Leaves - Allow anvil destroy item entities
Block block = this.blockState.getBlock();
DamageSource damagesource1;

39 changes: 39 additions & 0 deletions patches/server/0136-Disable-vault-blacklist.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: huanli233 <392352840@qq.com>
Date: Sun, 27 Oct 2024 15:57:37 +0800
Subject: [PATCH] Disable vault blacklist


diff --git a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultServerData.java b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultServerData.java
index 30544783d959fbdf4b6fd53c10bd3806e718a066..0a7cd5fad1eb0cc5770a4dd14349168fe7933721 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultServerData.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultServerData.java
@@ -57,11 +57,12 @@ public class VaultServerData {
}

boolean hasRewardedPlayer(Player player) {
- return this.rewardedPlayers.contains(player.getUUID());
+ return !org.leavesmc.leaves.LeavesConfig.disableVaultBlacklist && this.rewardedPlayers.contains(player.getUUID()); // Leaves - disable vault blacklist
}

@VisibleForTesting
public void addToRewardedPlayers(Player player) {
+ if (org.leavesmc.leaves.LeavesConfig.disableVaultBlacklist) return; // Leaves - disable vault blacklist
this.rewardedPlayers.add(player.getUUID());
if (this.rewardedPlayers.size() > 128) {
Iterator<UUID> iterator = this.rewardedPlayers.iterator();
diff --git a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultSharedData.java b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultSharedData.java
index f09ce717869741bb2f027ab1216fad9d86425683..b113f44e7e6a1f5303392bff09914f0260bd3bc6 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultSharedData.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultSharedData.java
@@ -68,8 +68,8 @@ public class VaultSharedData {
Set<UUID> set = config.playerDetector()
.detect(world, config.entitySelector(), pos, radius, false)
.stream()
- .filter(uuid -> !serverData.getRewardedPlayers().contains(uuid))
- .collect(Collectors.toSet());
+ .filter(uuid -> org.leavesmc.leaves.LeavesConfig.disableVaultBlacklist || !serverData.getRewardedPlayers().contains(uuid))
+ .collect(Collectors.toSet()); // Leaves - disable vault blacklist
if (!this.connectedPlayers.equals(set)) {
this.connectedPlayers = set;
this.markDirty();