aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-12-22 22:13:34 -0800
committerJake Potrebic <[email protected]>2024-12-23 14:50:03 -0800
commitfc72e384a55c63e6df3cd47e31e155e96a6671b0 (patch)
tree8ba92cfe231968ac6e53bf164e69967b80c698f4
parent957f493566248c2fd721bed6219d4ed163bc809d (diff)
downloadPaper-fc72e384a55c63e6df3cd47e31e155e96a6671b0.tar.gz
Paper-fc72e384a55c63e6df3cd47e31e155e96a6671b0.zip
fix other Holderables
-rw-r--r--.editorconfig3
-rw-r--r--paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch3
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java5
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java11
-rw-r--r--paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java11
5 files changed, 11 insertions, 22 deletions
diff --git a/.editorconfig b/.editorconfig
index 9c12172107..ac14754a32 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -32,6 +32,9 @@ ij_java_generate_final_parameters = true
ij_java_method_parameters_new_line_after_left_paren = true
ij_java_method_parameters_right_paren_on_new_line = true
+[paper-server/src/minecraft/java/**/*.java]
+ij_java_use_fq_class_names = true
+
[paper-server/src/minecraft/resources/data/**/*.json]
indent_size = 2
diff --git a/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch b/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch
index c625d649d2..97a14239e6 100644
--- a/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch
+++ b/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch
@@ -34,11 +34,12 @@
} catch (Exception var14) {
loadingErrors.put(
resourceKey,
-@@ -283,7 +_,8 @@
+@@ -283,7 +_,9 @@
}
}
- TagLoader.loadTagsForRegistry(resourceManager, registry);
++ io.papermc.paper.registry.PaperRegistryAccess.instance().lockReferenceHolders(registry.key()); // Paper - lock reference holders
+ io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.runFreezeListeners(registry.key(), conversions); // Paper - run pre-freeze listeners
+ TagLoader.loadTagsForRegistry(resourceManager, registry, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - tag lifecycle - add cause
}
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java
index 520c3e2e1d..7ad11769a1 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java
@@ -41,9 +41,6 @@ public class CraftMusicInstrument extends MusicInstrument implements io.papermc.
return io.papermc.paper.util.Holderable.fromBukkitSerializationObject(string, Instrument.CODEC, Registry.INSTRUMENT); // Paper - switch to Holder
}
- private final NamespacedKey key;
- private final Instrument handle;
-
// Paper start - switch to Holder
@Override
public boolean equals(final Object o) {
@@ -63,8 +60,6 @@ public class CraftMusicInstrument extends MusicInstrument implements io.papermc.
private final Holder<Instrument> holder;
public CraftMusicInstrument(Holder<Instrument> holder) {
this.holder = holder;
- this.key = holder.unwrapKey().map(io.papermc.paper.util.MCUtil::fromResourceKey).orElse(null);
- this.handle = holder.value();
// Paper end - switch to Holder
}
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
index 9b7488cb45..77378a90fa 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
@@ -30,9 +30,6 @@ public class CraftTrimMaterial implements TrimMaterial, io.papermc.paper.util.Ho
return CraftRegistry.bukkitToMinecraftHolder(bukkit, Registries.TRIM_MATERIAL); // Paper - switch to Holder
}
- private final NamespacedKey key;
- private final net.minecraft.world.item.equipment.trim.TrimMaterial handle;
-
// Paper start - switch to Holder
private final Holder<net.minecraft.world.item.equipment.trim.TrimMaterial> holder;
@@ -64,8 +61,6 @@ public class CraftTrimMaterial implements TrimMaterial, io.papermc.paper.util.Ho
}
public CraftTrimMaterial(final Holder<net.minecraft.world.item.equipment.trim.TrimMaterial> holder) {
- this.key = holder.unwrapKey().map(io.papermc.paper.util.MCUtil::fromResourceKey).orElse(null);
- this.handle = holder.value();
this.holder = holder;
// Paper end - switch to Holder
}
@@ -84,14 +79,14 @@ public class CraftTrimMaterial implements TrimMaterial, io.papermc.paper.util.Ho
@NotNull
@Override
public String getTranslationKey() {
- if (!(this.handle.description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
- return ((TranslatableContents) this.handle.description().getContents()).getKey();
+ if (!(this.getHandle().description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
+ return ((TranslatableContents) this.getHandle().description().getContents()).getKey();
}
// Paper start - adventure
@Override
public net.kyori.adventure.text.Component description() {
- return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.description());
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().description());
}
// Paper end - adventure
}
diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
index b5b209d16a..0d92f77467 100644
--- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
+++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimPattern.java
@@ -30,9 +30,6 @@ public class CraftTrimPattern implements TrimPattern, io.papermc.paper.util.Hold
return CraftRegistry.bukkitToMinecraftHolder(bukkit, Registries.TRIM_PATTERN); // Paper - switch to Holder
}
- private final NamespacedKey key;
- private final net.minecraft.world.item.equipment.trim.TrimPattern handle;
-
// Paper start - switch to Holder
private final Holder<net.minecraft.world.item.equipment.trim.TrimPattern> holder; // Paper - switch to Holder
@@ -64,8 +61,6 @@ public class CraftTrimPattern implements TrimPattern, io.papermc.paper.util.Hold
}
public CraftTrimPattern(Holder<net.minecraft.world.item.equipment.trim.TrimPattern> handle) {
- this.key = handle.unwrapKey().map(io.papermc.paper.util.MCUtil::fromResourceKey).orElse(null);
- this.handle = handle.value();
this.holder = handle;
// Paper end - switch to Holder
}
@@ -84,14 +79,14 @@ public class CraftTrimPattern implements TrimPattern, io.papermc.paper.util.Hold
@NotNull
@Override
public String getTranslationKey() {
- if (!(this.handle.description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
- return ((TranslatableContents) this.handle.description().getContents()).getKey();
+ if (!(this.getHandle().description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
+ return ((TranslatableContents) this.getHandle().description().getContents()).getKey();
}
// Paper start - adventure
@Override
public net.kyori.adventure.text.Component description() {
- return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.handle.description());
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().description());
}
// Paper end - adventure
}