diff options
author | Luis <[email protected]> | 2024-01-27 18:32:05 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-27 19:32:05 +0100 |
commit | b333831b70af5243a90760c654b973702d7af879 (patch) | |
tree | 55f57c9716e29dd1a06ef541458f058810196f5e | |
parent | 4643b0d9591179099be639ce5d684b65f88ebe2e (diff) | |
download | Paper-b333831b70af5243a90760c654b973702d7af879.tar.gz Paper-b333831b70af5243a90760c654b973702d7af879.zip |
Make spawn egg colours visible (#10158)
Co-authored-by: Yannick Lamprecht <[email protected]>
-rw-r--r-- | patches/api/0458-Add-api-for-spawn-egg-texture-colors.patch | 28 | ||||
-rw-r--r-- | patches/server/1043-Add-api-for-spawn-egg-texture-colors.patch | 26 |
2 files changed, 54 insertions, 0 deletions
diff --git a/patches/api/0458-Add-api-for-spawn-egg-texture-colors.patch b/patches/api/0458-Add-api-for-spawn-egg-texture-colors.patch new file mode 100644 index 0000000000..9f9ef4707d --- /dev/null +++ b/patches/api/0458-Add-api-for-spawn-egg-texture-colors.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luis <[email protected]> +Date: Thu, 11 Jan 2024 19:58:17 +0100 +Subject: [PATCH] Add api for spawn egg texture colors + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index a4b38f284d4fea7df7f9df9bf44e4f68fefaf20f..923d8655a84e26960d35d8dc6e4ebc0b10c295d5 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -260,4 +260,17 @@ public interface UnsafeValues { + + String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); + // Paper end ++ ++ // Paper start - spawn egg color visibility ++ /** ++ * Obtains the underlying color informating for a spawn egg of a given ++ * entity type, or null if the entity passed does not have a spawn egg. ++ * Spawn eggs have two colors - the background layer (0), and the ++ * foreground layer (1) ++ * @param entityType The entity type to get the color for ++ * @param layer The texture layer to get a color for ++ * @return The color of the layer for the entity's spawn egg ++ */ ++ @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); ++ // Paper end - spawn egg color visibility + } diff --git a/patches/server/1043-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/1043-Add-api-for-spawn-egg-texture-colors.patch new file mode 100644 index 0000000000..58fb31c714 --- /dev/null +++ b/patches/server/1043-Add-api-for-spawn-egg-texture-colors.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luis <[email protected]> +Date: Thu, 11 Jan 2024 19:58:23 +0100 +Subject: [PATCH] Add api for spawn egg texture colors + + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index 4e1390b9244aeb745ffd3fd1257bc74248722515..ca5312febcdd467889ad725c0263367bc5fe69f6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -645,6 +645,15 @@ public final class CraftMagicNumbers implements UnsafeValues { + } + // Paper end + ++ // Paper start - spawn egg color visibility ++ @Override ++ public org.bukkit.Color getSpawnEggLayerColor(final EntityType entityType, final int layer) { ++ final net.minecraft.world.entity.EntityType<?> nmsType = org.bukkit.craftbukkit.entity.CraftEntityType.bukkitToMinecraft(entityType); ++ final net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType); ++ return eggItem == null ? null : org.bukkit.Color.fromRGB(eggItem.getColor(layer)); ++ } ++ // Paper end - spawn egg color visibility ++ + /** + * This helper class represents the different NBT Tags. + * <p> |