mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed incompatibility with Mantle. Closes #8
This commit is contained in:
parent
a7d582f7cf
commit
040e191004
1 changed files with 20 additions and 9 deletions
|
@ -17,6 +17,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|||
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||
|
@ -55,8 +56,10 @@ class ClientHooks {
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderHud(RenderGameOverlayEvent.Pre event) {
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||
public static void beforePreRenderHud(RenderGameOverlayEvent.Pre event) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (event.getType() != ElementType.ALL) {
|
||||
IPlayer player = UClient.instance().getIPlayer();
|
||||
|
||||
|
@ -66,17 +69,25 @@ class ClientHooks {
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderHud(RenderGameOverlayEvent.Post event) {
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
|
||||
public static void afterPreRenderHud(RenderGameOverlayEvent.Pre event) {
|
||||
if (event.isCanceled()) {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public static void postRenderHud(RenderGameOverlayEvent.Post event) {
|
||||
|
||||
if (event.getType() == ElementType.ALL) {
|
||||
IPlayer player = UClient.instance().getIPlayer();
|
||||
|
||||
if (player != null && Minecraft.getMinecraft().world != null) {
|
||||
if (event.getType() == ElementType.ALL) {
|
||||
UHud.instance.renderHud(player, event.getResolution());
|
||||
} else {
|
||||
UHud.instance.repositionElements(player, event.getResolution(), event.getType(), false);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
Loading…
Reference in a new issue