mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Temp fix for EntityType.translationKey
Upstream improperly used the enum name for looking up the vanilla entity type to get the translation key; temp patch this until upstream fixes this, also add some quick validation
This commit is contained in:
parent
b15172bc8e
commit
19889e8a77
1 changed files with 24 additions and 0 deletions
24
patches/server/Temp-fix-for-EntityType.translationKey.patch
Normal file
24
patches/server/Temp-fix-for-EntityType.translationKey.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Thu, 16 Feb 2023 03:19:19 +0000
|
||||
Subject: [PATCH] Temp fix for EntityType.translationKey()
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(EntityType entityType) {
|
||||
- return net.minecraft.world.entity.EntityType.byString(entityType.name()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElseThrow();
|
||||
+ // Paper start
|
||||
+ if (entityType.getName() == null || entityType == EntityType.UNKNOWN) {
|
||||
+ throw new IllegalArgumentException("Cannot lookup translation key of entity type " + entityType);
|
||||
+ }
|
||||
+ return net.minecraft.world.entity.EntityType.byString(entityType.getName()).map(net.minecraft.world.entity.EntityType::getDescriptionId).orElseThrow();
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in a new issue