2022-10-12 21:09:18 +02:00
|
|
|
package magicbees.bees;
|
|
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
import java.util.Locale;
|
2023-01-29 10:24:49 -08:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
|
import net.minecraft.util.IIcon;
|
2022-10-12 21:09:18 +02:00
|
|
|
|
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
import forestry.api.apiculture.EnumBeeType;
|
|
|
|
|
import forestry.api.apiculture.IBeeIconProvider;
|
2023-04-28 17:50:21 +02:00
|
|
|
import magicbees.main.CommonProxy;
|
2023-01-29 10:24:49 -08:00
|
|
|
|
2022-10-12 21:09:18 +02:00
|
|
|
public enum BeeIconProvider implements IBeeIconProvider {
|
2023-01-29 10:24:49 -08:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
|
|
|
|
|
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
|
|
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
private IIcon[][] icons;
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
private final String iconPath;
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
BeeIconProvider(String iconPath) {
|
|
|
|
|
this.iconPath = iconPath;
|
|
|
|
|
}
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
@Override
|
|
|
|
|
public void registerIcons(IIconRegister itemMap) {
|
|
|
|
|
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
|
|
|
|
|
EnumBeeType beeType = EnumBeeType.VALUES[i];
|
|
|
|
|
if (beeType == EnumBeeType.NONE) continue;
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
|
|
|
|
|
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
|
|
|
|
|
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-10-12 21:09:18 +02:00
|
|
|
|
2022-10-12 21:09:45 +02:00
|
|
|
@Override
|
|
|
|
|
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
|
|
|
|
return icons[type.ordinal()][Math.min(renderPass, 2)];
|
|
|
|
|
}
|
2022-10-12 21:09:18 +02:00
|
|
|
}
|