Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.meepshadow.xlifehealth.XLifeHealth;
- import net.minecraft.client.MainWindow;
- import net.minecraft.client.Minecraft;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.client.event.RenderGameOverlayEvent;
- import net.minecraftforge.eventbus.api.SubscribeEvent;
- import net.minecraftforge.fml.client.gui.GuiUtils;
- import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.HEALTH;
- public class HeartColors extends GuiUtils {
- public static final ResourceLocation BLUE_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/blue_hearts.png");
- public static final ResourceLocation GREEN_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/green_hearts.png");
- public static final ResourceLocation ORANGE_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/orange_hearts.png");
- public static final ResourceLocation PINK_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/pink_hearts.png");
- public static final ResourceLocation PURPLE_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/purple_hearts.png");
- public static final ResourceLocation YELLOW_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/yellow_hearts.png");
- public static final ResourceLocation CYAN_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/cyan_hearts.png");
- public static final ResourceLocation MAGENTA_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/magenta_hearts.png");
- public static final ResourceLocation BLACK_HEARTS = new ResourceLocation(XLifeHealth.MOD_ID, "textures/gui/black_hearts.png");
- private final int tex_width = 7, tex_height = 7;
- @SubscribeEvent
- public void setHeartColors(RenderGameOverlayEvent.Pre event) {
- if (event.getType() == HEALTH)
- setBlueHearts(event);
- setGreenHearts(event);
- setOrangeHearts(event);
- setPinkHearts(event);
- setPurpleHearts(event);
- setYellowHearts(event);
- setCyanHearts(event);
- setMagentaHearts(event);
- setBlackHearts(event);
- }
- public void setBlueHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(BLUE_HEARTS);
- bind(BLUE_HEARTS);
- }
- }
- public void setGreenHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(GREEN_HEARTS);
- bind(GREEN_HEARTS);
- }
- }
- public void setOrangeHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(ORANGE_HEARTS);
- bind(ORANGE_HEARTS);
- }
- }
- public void setPinkHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(PINK_HEARTS);
- bind(PINK_HEARTS);
- }
- }
- public void setPurpleHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(PURPLE_HEARTS);
- bind(PURPLE_HEARTS);
- }
- }
- public void setYellowHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(YELLOW_HEARTS);
- bind(YELLOW_HEARTS);
- }
- }
- public void setCyanHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(CYAN_HEARTS);
- bind(CYAN_HEARTS);
- }
- }
- public void setMagentaHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(MAGENTA_HEARTS);
- bind(MAGENTA_HEARTS);
- }
- }
- public void setBlackHearts(RenderGameOverlayEvent event) {
- if (event.getType() == RenderGameOverlayEvent.ElementType.HEALTH) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(BLACK_HEARTS);
- bind(BLACK_HEARTS);
- }
- }
- private void bind(ResourceLocation res) {
- Minecraft mc = Minecraft.getInstance();
- mc.getTextureManager().bindTexture(res);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement