mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Make ForgeSpawnEgg assume color is opaque if alpha is set to 0.
Fixes "invisible" spawn eggs by default, but still allows modders to specify partial transparency.
This commit is contained in:
1 file changed
+9
-3
@@ -7,6 +7,7 @@ package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.dispenser.DispenseItemBehavior;
|
||||
import net.minecraft.util.FastColor;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
@@ -91,9 +92,14 @@ public class ForgeSpawnEggItem extends SpawnEggItem {
|
||||
private static class ColorRegisterHandler {
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void registerSpawnEggColors(RegisterColorHandlersEvent.Item event) {
|
||||
MOD_EGGS.forEach(egg ->
|
||||
event.register((stack, layer) -> egg.getColor(layer), egg)
|
||||
);
|
||||
MOD_EGGS.forEach(egg -> {
|
||||
event.register((stack, layer) -> {
|
||||
int color = egg.getColor(layer);
|
||||
if (FastColor.ARGB32.alpha(color) == 0)
|
||||
color = FastColor.ARGB32.opaque(color);
|
||||
return color;
|
||||
}, egg);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user