mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
1 parent
fa21f2b44c
commit
35999f9a20
3 files changed
+100
-1
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.BOSSINFO;
|
||||
import static net.minecraftforge.common.ForgeVersion.Status.BETA;
|
||||
import static net.minecraftforge.common.ForgeVersion.Status.BETA_OUTDATED;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
@@ -22,6 +23,7 @@ import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -61,6 +63,7 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.BossInfoLerping;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
@@ -70,12 +73,14 @@ import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.animation.Animation;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
@@ -652,4 +657,17 @@ public class ForgeHooksClient
|
||||
int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.y, rv.x)) / 90) * 90, 360);
|
||||
return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle);
|
||||
}
|
||||
|
||||
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment)
|
||||
{
|
||||
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),
|
||||
BOSSINFO, bossInfo, x, y, increment);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt;
|
||||
}
|
||||
|
||||
public static void bossBarRenderPost(ScaledResolution res)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.world.BossInfoLerping;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@@ -31,7 +32,8 @@ public class RenderGameOverlayEvent extends Event
|
||||
HELMET,
|
||||
PORTAL,
|
||||
CROSSHAIRS,
|
||||
BOSSHEALTH,
|
||||
BOSSHEALTH, // All boss bars
|
||||
BOSSINFO, // Individual boss bar
|
||||
ARMOR,
|
||||
HEALTH,
|
||||
FOOD,
|
||||
@@ -83,6 +85,63 @@ public class RenderGameOverlayEvent extends Event
|
||||
@Override public boolean isCancelable(){ return false; }
|
||||
}
|
||||
|
||||
public static class BossInfo extends Pre
|
||||
{
|
||||
private final BossInfoLerping bossInfo;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private int increment;
|
||||
public BossInfo(RenderGameOverlayEvent parent, ElementType type, BossInfoLerping bossInfo, int x, int y, int increment)
|
||||
{
|
||||
super(parent, type);
|
||||
this.bossInfo = bossInfo;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.increment = increment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The {@link BossInfoLerping} currently being rendered
|
||||
*/
|
||||
public BossInfoLerping getBossInfo()
|
||||
{
|
||||
return bossInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current x position we are rendering at
|
||||
*/
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current y position we are rendering at
|
||||
*/
|
||||
public int getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return How much to move down before rendering the next bar
|
||||
*/
|
||||
public int getIncrement()
|
||||
{
|
||||
return increment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the amount to move down before rendering the next bar
|
||||
* @param increment The increment to set
|
||||
*/
|
||||
public void setIncrement(int increment)
|
||||
{
|
||||
this.increment = increment;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Text extends Pre
|
||||
{
|
||||
private final ArrayList<String> left;
|
||||
|
||||
Reference in new issue
Block a user