Add Translatable interface to MusicInstrument (#9538)

This commit is contained in:
Jake Potrebic
2023-07-28 15:06:27 -07:00
parent cbfc2065f5
commit 1f967356b8
2 changed files with 38 additions and 0 deletions

View File

@@ -49,8 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.destroystokyo.paper.ClientOption;
+import java.util.Map;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.network.chat.contents.TranslatableContents;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.ChatVisiblity;
+import net.minecraft.world.level.GameType;
+import net.minecraft.world.level.biome.Biome;
@@ -58,7 +60,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.FireworkEffect;
+import org.bukkit.GameMode;
+import org.bukkit.GameRule;
+import org.bukkit.MusicInstrument;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.support.AbstractTestingBase;
import org.junit.Assert;
+import org.junit.Ignore;
@@ -126,5 +130,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.bukkit.block.Biome bukkit = org.bukkit.block.Biome.valueOf(nms.getKey().location().getPath().toUpperCase());
+ Assert.assertEquals("translation key mismatch for " + bukkit, nms.getKey().location().toLanguageKey("biome"), bukkit.translationKey());
+ }
+ }
+
+ @Test
+ public void testMusicInstrument() {
+ for (final ResourceLocation nms : BuiltInRegistries.INSTRUMENT.keySet()) {
+ final MusicInstrument bukkit = MusicInstrument.getByKey(CraftNamespacedKey.fromMinecraft(nms));
+ Assert.assertNotNull("Missing bukkit instrument for " + nms, bukkit);
+ Assert.assertEquals("translation key mismatch for " + bukkit, nms.toLanguageKey("instrument"), bukkit.translationKey());
+ }
+ }
}