|
17 | 17 | import com.google.common.collect.BiMap; |
18 | 18 | import com.google.common.collect.ImmutableBiMap; |
19 | 19 | import com.mojang.blaze3d.platform.InputConstants; |
| 20 | +import com.mojang.blaze3d.textures.GpuTextureView; |
20 | 21 | import com.mojang.brigadier.exceptions.CommandSyntaxException; |
21 | 22 | import dev.xpple.seedmapper.SeedMapper; |
22 | 23 | import dev.xpple.seedmapper.command.arguments.CanyonCarverArgument; |
|
47 | 48 | import net.minecraft.client.gui.GuiGraphics; |
48 | 49 | import net.minecraft.client.gui.components.EditBox; |
49 | 50 | import net.minecraft.client.gui.components.PlayerFaceRenderer; |
| 51 | +import net.minecraft.client.gui.render.TextureSetup; |
| 52 | +import net.minecraft.client.gui.render.state.BlitRenderState; |
50 | 53 | import net.minecraft.client.gui.screens.Screen; |
51 | 54 | import net.minecraft.client.input.KeyEvent; |
52 | 55 | import net.minecraft.client.input.MouseButtonEvent; |
|
76 | 79 | import net.minecraft.world.level.levelgen.WorldgenRandom; |
77 | 80 | import net.minecraft.world.level.levelgen.XoroshiroRandomSource; |
78 | 81 | import org.jetbrains.annotations.Nullable; |
| 82 | +import org.joml.Matrix3x2f; |
79 | 83 |
|
80 | 84 | import java.lang.foreign.Arena; |
81 | 85 | import java.lang.foreign.MemoryLayout; |
@@ -327,6 +331,8 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia |
327 | 331 | } |
328 | 332 | } |
329 | 333 |
|
| 334 | + guiGraphics.nextStratum(); |
| 335 | + |
330 | 336 | int horChunkRadius = Math.ceilDiv(this.seedMapWidth / 2, SCALED_CHUNK_SIZE * Configs.PixelsPerBiome); |
331 | 337 | int verChunkRadius = Math.ceilDiv(this.seedMapHeight / 2, SCALED_CHUNK_SIZE * Configs.PixelsPerBiome); |
332 | 338 |
|
@@ -364,6 +370,8 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia |
364 | 370 | } |
365 | 371 | }); |
366 | 372 |
|
| 373 | + guiGraphics.nextStratum(); |
| 374 | + |
367 | 375 | // draw strongholds |
368 | 376 | if (this.toggleableFeatures.contains(MapFeature.STRONGHOLD) && Configs.ToggledFeatures.contains(MapFeature.STRONGHOLD)) { |
369 | 377 | TwoDTree tree = strongholdDataCache.get(this.worldIdentifier); |
@@ -1060,7 +1068,13 @@ public boolean equals(Object o) { |
1060 | 1068 | static void drawFeatureIcon(GuiGraphics guiGraphics, MapFeature.Texture texture, int minX, int minY, int colour) { |
1061 | 1069 | int iconWidth = texture.width(); |
1062 | 1070 | int iconHeight = texture.height(); |
1063 | | - guiGraphics.blit(RenderPipelines.GUI_TEXTURED, texture.resourceLocation(), minX, minY, 0, 0, iconWidth, iconHeight, iconWidth, iconHeight, colour); |
| 1071 | + |
| 1072 | + // Skip intersection checks (GuiRenderState.hasIntersection) you would otherwise get when calling |
| 1073 | + // GuiGraphics.blit(RenderPipeline, ResourceLocation, int, int, float, float, int, int, int, int, int) |
| 1074 | + // as these checks incur a significant performance hit |
| 1075 | + GpuTextureView gpuTextureView = Minecraft.getInstance().getTextureManager().getTexture(texture.resourceLocation()).getTextureView(); |
| 1076 | + BlitRenderState renderState = new BlitRenderState(RenderPipelines.GUI_TEXTURED, TextureSetup.singleTexture(gpuTextureView), new Matrix3x2f(guiGraphics.pose()), minX, minY, minX + iconWidth, minY + iconHeight, 0, 1, 0, 1, colour, guiGraphics.scissorStack.peek()); |
| 1077 | + guiGraphics.guiRenderState.submitBlitToCurrentLayer(renderState); |
1064 | 1078 | } |
1065 | 1079 | } |
1066 | 1080 |
|
|
0 commit comments