|
79 | 79 | import net.minecraft.world.phys.BlockHitResult; |
80 | 80 | import net.minecraft.world.phys.HitResult.Type; |
81 | 81 | import net.minecraft.world.phys.Vec3; |
| 82 | +import net.neoforged.bus.api.EventPriority; |
82 | 83 | import net.neoforged.bus.api.SubscribeEvent; |
83 | 84 | import net.neoforged.neoforge.client.ClientHooks; |
84 | 85 | import net.neoforged.neoforge.client.event.ClientTickEvent; |
@@ -144,6 +145,26 @@ public static void guiOpening(ScreenEvent.Opening event) { |
144 | 145 | } |
145 | 146 | } |
146 | 147 |
|
| 148 | + @SubscribeEvent(priority = EventPriority.HIGHEST) |
| 149 | + public void renderPostHighest(ScreenEvent.Render.Post event) { |
| 150 | + if (event.getScreen() instanceof GuiMekanism) { |
| 151 | + //Translate forward how far we go, so that things like recipe viewers draw far enough forward |
| 152 | + // Note: We will pop this in a listener at the lowest priority |
| 153 | + PoseStack pose = event.getGuiGraphics().pose(); |
| 154 | + pose.pushPose(); |
| 155 | + //Note: We translate forward an extra 200, so that items rendered in a gui window don't overlap EMI based tooltips |
| 156 | + pose.translate(0, 0, 200 + GuiMekanism.maxZOffset); |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + @SubscribeEvent(priority = EventPriority.LOWEST) |
| 161 | + public void renderPostLowest(ScreenEvent.Render.Post event) { |
| 162 | + if (event.getScreen() instanceof GuiMekanism) { |
| 163 | + //Matching pop to the push we did in renderPostHighest |
| 164 | + event.getGuiGraphics().pose().popPose(); |
| 165 | + } |
| 166 | + } |
| 167 | + |
147 | 168 | public static void addTransparentRenderer(LazyRender render) { |
148 | 169 | transparentRenderers.add(render); |
149 | 170 | } |
|
0 commit comments