|
21 | 21 | import com.google.common.collect.BiMap; |
22 | 22 | import com.google.common.collect.ImmutableBiMap; |
23 | 23 | import com.mojang.blaze3d.platform.InputConstants; |
| 24 | +import com.mojang.blaze3d.textures.GpuTextureView; |
24 | 25 | import com.mojang.brigadier.exceptions.CommandSyntaxException; |
25 | 26 | import com.mojang.logging.LogUtils; |
26 | 27 | import dev.xpple.seedmapper.SeedMapper; |
|
56 | 57 | import net.minecraft.client.gui.components.Button; |
57 | 58 | import net.minecraft.client.gui.components.EditBox; |
58 | 59 | import net.minecraft.client.gui.components.PlayerFaceRenderer; |
| 60 | +import net.minecraft.client.gui.render.TextureSetup; |
| 61 | +import net.minecraft.client.gui.render.state.BlitRenderState; |
59 | 62 | import net.minecraft.client.gui.screens.Screen; |
60 | 63 | import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; |
61 | 64 | import net.minecraft.client.gui.screens.inventory.tooltip.DefaultTooltipPositioner; |
|
88 | 91 | import net.minecraft.world.level.levelgen.XoroshiroRandomSource; |
89 | 92 | import org.jetbrains.annotations.Nullable; |
90 | 93 | import org.slf4j.Logger; |
| 94 | +import org.joml.Matrix3x2f; |
91 | 95 |
|
92 | 96 | import java.lang.foreign.Arena; |
93 | 97 | import java.lang.foreign.MemoryLayout; |
@@ -383,9 +387,10 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia |
383 | 387 | } |
384 | 388 | } |
385 | 389 |
|
386 | | - double scaledChunkSpan = SCALED_CHUNK_SIZE * Math.max(MIN_PIXELS_PER_BIOME, Configs.PixelsPerBiome); |
387 | | - int horChunkRadius = (int) Math.ceil((this.seedMapWidth / 2.0) / scaledChunkSpan); |
388 | | - int verChunkRadius = (int) Math.ceil((this.seedMapHeight / 2.0) / scaledChunkSpan); |
| 390 | + guiGraphics.nextStratum(); |
| 391 | + |
| 392 | + int horChunkRadius = Math.ceilDiv(this.seedMapWidth / 2, SCALED_CHUNK_SIZE * Configs.PixelsPerBiome); |
| 393 | + int verChunkRadius = Math.ceilDiv(this.seedMapHeight / 2, SCALED_CHUNK_SIZE * Configs.PixelsPerBiome); |
389 | 394 |
|
390 | 395 | // compute structures |
391 | 396 | Configs.ToggledFeatures.stream() |
@@ -431,6 +436,8 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia |
431 | 436 | } |
432 | 437 | }); |
433 | 438 |
|
| 439 | + guiGraphics.nextStratum(); |
| 440 | + |
434 | 441 | // draw strongholds |
435 | 442 | if (this.toggleableFeatures.contains(MapFeature.STRONGHOLD) && Configs.ToggledFeatures.contains(MapFeature.STRONGHOLD)) { |
436 | 443 | TwoDTree tree = strongholdDataCache.get(this.worldIdentifier); |
@@ -1668,7 +1675,13 @@ public boolean equals(Object o) { |
1668 | 1675 | static void drawFeatureIcon(GuiGraphics guiGraphics, MapFeature.Texture texture, int minX, int minY, int colour) { |
1669 | 1676 | int iconWidth = texture.width(); |
1670 | 1677 | int iconHeight = texture.height(); |
1671 | | - guiGraphics.blit(RenderPipelines.GUI_TEXTURED, texture.resourceLocation(), minX, minY, 0, 0, iconWidth, iconHeight, iconWidth, iconHeight, colour); |
| 1678 | + |
| 1679 | + // Skip intersection checks (GuiRenderState.hasIntersection) you would otherwise get when calling |
| 1680 | + // GuiGraphics.blit(RenderPipeline, ResourceLocation, int, int, float, float, int, int, int, int, int) |
| 1681 | + // as these checks incur a significant performance hit |
| 1682 | + GpuTextureView gpuTextureView = Minecraft.getInstance().getTextureManager().getTexture(texture.resourceLocation()).getTextureView(); |
| 1683 | + 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()); |
| 1684 | + guiGraphics.guiRenderState.submitBlitToCurrentLayer(renderState); |
1672 | 1685 | } |
1673 | 1686 | } |
1674 | 1687 |
|
|
0 commit comments