Deprecate UnsafeValues#getSpawnEggLayerColor (#12041)

This commit is contained in:
Lulu13022002
2025-01-31 13:17:45 +01:00
committed by GitHub
parent 5bcfb12a99
commit e0711af5d5
2 changed files with 10 additions and 8 deletions

View File

@@ -8,7 +8,6 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier; import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.damage.DamageEffect;
import org.bukkit.damage.DamageSource; import org.bukkit.damage.DamageSource;
import org.bukkit.damage.DamageType; import org.bukkit.damage.DamageType;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@@ -359,14 +358,17 @@ public interface UnsafeValues {
// Paper start - spawn egg color visibility // Paper start - spawn egg color visibility
/** /**
* Obtains the underlying color informating for a spawn egg of a given * 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. * entity type, or {@code null} if the entity passed does not have a spawn egg.
* Spawn eggs have two colors - the background layer (0), and the * Spawn eggs have two colors - the background layer (0), and the
* foreground layer (1) * foreground layer (1)
* @param entityType The entity type to get the color for *
* @param layer The texture layer to get a color for * @param entityType the entity type to get the color for
* @return The color of the layer for the entity's spawn egg * @param layer the texture layer to get a color for
* @return the color of the layer for the entity's spawn egg
* @deprecated the color is no longer available to the server
*/ */
@Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); @Deprecated(since = "1.21.4")
@Nullable Color getSpawnEggLayerColor(EntityType entityType, int layer);
// Paper end - spawn egg color visibility // Paper end - spawn egg color visibility
// Paper start - lifecycle event API // Paper start - lifecycle event API

View File

@@ -751,9 +751,9 @@ public final class CraftMagicNumbers implements UnsafeValues {
final net.minecraft.world.entity.EntityType<?> nmsType = org.bukkit.craftbukkit.entity.CraftEntityType.bukkitToMinecraft(entityType); 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); final net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
if (eggItem != null) { if (eggItem != null) {
throw new UnsupportedOperationException("Not yet implemented"); throw new UnsupportedOperationException();
} }
return eggItem == null ? null : org.bukkit.Color.fromRGB(1); // TODO return null;
} }
// Paper end - spawn egg color visibility // Paper end - spawn egg color visibility