Paper/patches/server/0731-Add-option-for-strict-advancement-dimension-checks.patch
Jake Potrebic 3e90a19183
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
304e83eb PR-1002: Improve documentation and implementation of getMaxStackSize
e8215ea2 SPIGOT-7638: Library loader does not seem to resolve every dependency
79c595c0 SPIGOT-7637: Bad logic in checking nullability of AttributeModifier slots

CraftBukkit Changes:
91b1fc3f1 SPIGOT-7644: Fix ItemMeta#getAsString
4e77a81e1 SPIGOT-7615: PlayerLeashEntityEvent cancelled eats lead
996f660f3 Do not remove leash knot if leasing to an existing leash knot gets cancelled
f70367d42 SPIGOT-7643: Fix inverted leash event cancelled usage and remove leash knot if no entity gets leashed
7ddb48294 SPIGOT-7640: Abnormal jumping height of wind charge
080c8711e SPIGOT-7639: Incoming plugin channels not working
ad549847e Open a direct connection instead of pinging mojang server to check if it is reachable
38e2926c5 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime
2024-04-27 18:00:01 -07:00

43 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 12 Jun 2022 11:47:24 -0700
Subject: [PATCH] Add option for strict advancement dimension checks
Craftbukkit attempts to translate worlds that use the
same generation as the Overworld, The Nether, or The End
to use those dimensions when checking the `changed_dimension`
criteria trigger, or whether to trigger the `NETHER_TRAVEL`
distance trigger. This adds a config option to ignore that
and use the exact dimension key of the worlds involved.
diff --git a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java
index 5be2d877162922d6f29592e723b7d5aff14e1515..37174de2319e353b2f989d8321758a081c655a3f 100644
--- a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java
+++ b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java
@@ -42,7 +42,7 @@ public record LocationPredicate(
public boolean matches(ServerLevel world, double x, double y, double z) {
if (this.position.isPresent() && !this.position.get().matches(x, y, z)) {
return false;
- } else if (this.dimension.isPresent() && this.dimension.get() != world.dimension()) {
+ } else if (this.dimension.isPresent() && this.dimension.get() != (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck ? world.dimension() : org.bukkit.craftbukkit.util.CraftDimensionUtil.getMainDimensionKey(world))) { // Paper - Add option for strict advancement dimension checks
return false;
} else {
BlockPos blockPos = BlockPos.containing(x, y, z);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 00114ada4ad98e355e6c182fe49b6852bd9cf0c7..269c0f53d37e968ae25e38ef81a11c9d5284c494 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1349,6 +1349,12 @@ public class ServerPlayer extends Player {
ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin);
ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
+ // Paper start - Add option for strict advancement dimension checks
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck) {
+ maindimensionkey = resourcekey;
+ maindimensionkey1 = resourcekey1;
+ }
+ // Paper end - Add option for strict advancement dimension checks
CriteriaTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
CriteriaTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1);