mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 14:30:17 +01:00
fix other Holderables
This commit is contained in:
parent
957f493566
commit
fc72e384a5
5 changed files with 11 additions and 22 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue