diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index 87c9d2bc5..7e49a0950 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -121,7 +121,7 @@ public class UIRenderHelper { /** * x and y specify the middle point of the starting edge * - * @param angle the angle of the gradient in degrees; 0° means from left to right + * @param angle the angle of the gradient in degrees; 0° means from left to right * @param color1 the color at the starting edge * @param color2 the color at the ending edge * @param breadth the total width of the gradient @@ -153,13 +153,13 @@ public class UIRenderHelper { private static void breadcrumbArrow(PoseStack ms, int width, int height, int indent, Color c1, Color c2) { /* - * 0,0 x1,y1 ********************* x4,y4 ***** x7,y7 - * **** **** - * **** **** - * x0,y0 x2,y2 x5,y5 - * **** **** - * **** **** - * x3,y3 ********************* x6,y6 ***** x8,y8 + * 0,0 x1,y1 ********************* x4,y4 ***** x7,y7 + * **** **** + * **** **** + * x0,y0 x2,y2 x5,y5 + * **** **** + * **** **** + * x3,y3 ********************* x6,y6 ***** x8,y8 * */ diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 76941e6fd..09f327398 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -429,6 +429,7 @@ public class PonderUI extends NavigatableSimiScreen { RenderSystem.enableDepthTest(); // RenderSystem.pushMatrix(); + // TODO 1.17: is the following still true? // has to be outside of MS transforms, important for vertex sorting // RenderSystem.translated(0, 0, 800); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagIndexScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagIndexScreen.java index e3118ca5a..be34a64f3 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagIndexScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagIndexScreen.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Optional; import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.gui.AllIcons; @@ -205,12 +206,19 @@ public class PonderTagIndexScreen extends NavigatableSimiScreen { @Override protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + RenderSystem.disableDepthTest(); + ms.pushPose(); + ms.translate(0, 0, 200); + if (hoveredItem != null) { List list = TooltipHelper.cutStringTextComponent(hoveredItem.getDescription(), ChatFormatting.GRAY, ChatFormatting.GRAY); list.add(0, new TextComponent(hoveredItem.getTitle())); renderComponentTooltip(ms, list, mouseX, mouseY); } + + ms.popPose(); + RenderSystem.enableDepthTest(); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java index 977d5e94b..4e5e52e4e 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Objects; import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.Create; import com.simibubi.create.foundation.gui.BoxElement; @@ -293,9 +294,16 @@ public class PonderTagScreen extends NavigatableSimiScreen { @Override protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) { + RenderSystem.disableDepthTest(); + ms.pushPose(); + ms.translate(0, 0, 200); + if (!hoveredItem.isEmpty()) { renderTooltip(ms, hoveredItem, mouseX, mouseY); } + + ms.popPose(); + RenderSystem.enableDepthTest(); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java b/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java index fcd22ce4c..25a54b68d 100644 --- a/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java +++ b/src/main/java/com/simibubi/create/foundation/render/RenderTypes.java @@ -35,6 +35,7 @@ public class RenderTypes extends RenderStateShard { .setCullState(cull ? CULL : NO_CULL) .setLightmapState(LIGHTMAP) .setOverlayState(OVERLAY) + .setWriteMaskState(COLOR_WRITE) .createCompositeState(true)); } diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java index 1c48cb492..0267feeed 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperRenderTypeBuffer.java @@ -15,17 +15,15 @@ import net.minecraft.client.resources.model.ModelBakery; public class SuperRenderTypeBuffer implements MultiBufferSource { - static SuperRenderTypeBuffer instance; + private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer();; public static SuperRenderTypeBuffer getInstance() { - if (instance == null) - instance = new SuperRenderTypeBuffer(); - return instance; + return INSTANCE; } - SuperRenderTypeBufferPhase earlyBuffer; - SuperRenderTypeBufferPhase defaultBuffer; - SuperRenderTypeBufferPhase lateBuffer; + private SuperRenderTypeBufferPhase earlyBuffer; + private SuperRenderTypeBufferPhase defaultBuffer; + private SuperRenderTypeBufferPhase lateBuffer; public SuperRenderTypeBuffer() { earlyBuffer = new SuperRenderTypeBufferPhase(); @@ -34,65 +32,64 @@ public class SuperRenderTypeBuffer implements MultiBufferSource { } public VertexConsumer getEarlyBuffer(RenderType type) { - return earlyBuffer.getBuffer(type); + return earlyBuffer.bufferSource.getBuffer(type); } @Override public VertexConsumer getBuffer(RenderType type) { - return defaultBuffer.getBuffer(type); + return defaultBuffer.bufferSource.getBuffer(type); } public VertexConsumer getLateBuffer(RenderType type) { - return lateBuffer.getBuffer(type); + return lateBuffer.bufferSource.getBuffer(type); } public void draw() { - earlyBuffer.endBatch(); - defaultBuffer.endBatch(); - lateBuffer.endBatch(); + earlyBuffer.bufferSource.endBatch(); + defaultBuffer.bufferSource.endBatch(); + lateBuffer.bufferSource.endBatch(); } public void draw(RenderType type) { - earlyBuffer.endBatch(type); - defaultBuffer.endBatch(type); - lateBuffer.endBatch(type); + earlyBuffer.bufferSource.endBatch(type); + defaultBuffer.bufferSource.endBatch(type); + lateBuffer.bufferSource.endBatch(type); } - private static class SuperRenderTypeBufferPhase extends MultiBufferSource.BufferSource { + private static class SuperRenderTypeBufferPhase { - // Visible clones from net.minecraft.client.renderer.RenderTypeBuffers - static final ChunkBufferBuilderPack blockBuilders = new ChunkBufferBuilderPack(); - - static final SortedMap createEntityBuilders() { - return Util.make(new Object2ObjectLinkedOpenHashMap<>(), (map) -> { - map.put(Sheets.solidBlockSheet(), blockBuilders.builder(RenderType.solid())); - assign(map, RenderTypes.getOutlineSolid()); - map.put(Sheets.cutoutBlockSheet(), blockBuilders.builder(RenderType.cutout())); - map.put(Sheets.bannerSheet(), blockBuilders.builder(RenderType.cutoutMipped())); - map.put(Sheets.translucentCullBlockSheet(), blockBuilders.builder(RenderType.translucent())); // FIXME new equivalent of getEntityTranslucent() ? - assign(map, Sheets.shieldSheet()); - assign(map, Sheets.bedSheet()); - assign(map, Sheets.shulkerBoxSheet()); - assign(map, Sheets.signSheet()); - assign(map, Sheets.chestSheet()); - assign(map, RenderType.translucentNoCrumbling()); - assign(map, RenderType.glint()); - assign(map, RenderType.entityGlint()); - assign(map, RenderType.waterMask()); - ModelBakery.DESTROY_TYPES.forEach((p_228488_1_) -> { - assign(map, p_228488_1_); + // Visible clones from RenderBuffers + private final ChunkBufferBuilderPack fixedBufferPack = new ChunkBufferBuilderPack(); + private final SortedMap fixedBuffers = Util.make(new Object2ObjectLinkedOpenHashMap<>(), map -> { + map.put(Sheets.solidBlockSheet(), fixedBufferPack.builder(RenderType.solid())); + map.put(Sheets.cutoutBlockSheet(), fixedBufferPack.builder(RenderType.cutout())); + map.put(Sheets.bannerSheet(), fixedBufferPack.builder(RenderType.cutoutMipped())); + map.put(Sheets.translucentCullBlockSheet(), fixedBufferPack.builder(RenderType.translucent())); + put(map, Sheets.shieldSheet()); + put(map, Sheets.bedSheet()); + put(map, Sheets.shulkerBoxSheet()); + put(map, Sheets.signSheet()); + put(map, Sheets.chestSheet()); + put(map, RenderType.translucentNoCrumbling()); + put(map, RenderType.armorGlint()); + put(map, RenderType.armorEntityGlint()); + put(map, RenderType.glint()); + put(map, RenderType.glintDirect()); + put(map, RenderType.glintTranslucent()); + put(map, RenderType.entityGlint()); + put(map, RenderType.entityGlintDirect()); + put(map, RenderType.waterMask()); + put(map, RenderTypes.getOutlineSolid()); + ModelBakery.DESTROY_TYPES.forEach((p_173062_) -> { + put(map, p_173062_); }); }); - } + private final MultiBufferSource.BufferSource bufferSource = MultiBufferSource.immediateWithBuffers(fixedBuffers, new BufferBuilder(256)); - private static void assign(Object2ObjectLinkedOpenHashMap map, RenderType type) { + private static void put(Object2ObjectLinkedOpenHashMap map, RenderType type) { map.put(type, new BufferBuilder(type.bufferSize())); } - protected SuperRenderTypeBufferPhase() { - super(new BufferBuilder(256), createEntityBuilders()); - } - } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java index 10cbd4716..072d46a30 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedChunkProvider.java @@ -79,7 +79,6 @@ public class WrappedChunkProvider extends ChunkSource { @Override public int getLoadedChunksCount() { - // TODO Auto-generated method stub return 0; } }