Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

allprojects {
group = "org.enginehub.worldeditcui"
version = "${rootProject.libs.versions.minecraft.get()}+02-SNAPSHOT"
version = "${rootProject.libs.versions.minecraft.get()}+01-SNAPSHOT"

repositories {
// mirrors:
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ format = { version = "1.1" }

[versions]
indra = "3.1.3"
minecraft = "1.21.10"
fabricLoader = "0.17.3"
fabricApi = "0.138.0+1.21.10"
minecraft = "1.21.11"
fabricLoader = "0.18.3"
fabricApi = "0.140.0+1.21.11"
modmenu = "16.0.0-rc.1"
viafabricplus = "3.3.0"
vineflower = "1.10.1"
cuiProtocol = "4.0.2"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
parchment = { module = "org.parchmentmc.data:parchment-1.21.9", version = "2025.10.05" }
parchment = { module = "org.parchmentmc.data:parchment-1.21.10", version = "2025.10.12" }
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabricLoader" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabricApi" }
fabric-api-bom = { module = "net.fabricmc.fabric-api:fabric-api-bom", version.ref = "fabricApi" }
Expand All @@ -31,17 +31,17 @@ curseForgeGradle = { id = "net.darkhax.curseforgegradle", version = "1.1.26" }
indra-git = { id = "net.kyori.indra.git", version.ref = "indra" }
indra-spotlessLicenser = { id = "net.kyori.indra.licenser.spotless", version.ref = "indra" }
jvmConflictResolution = { id = "org.gradlex.jvm-dependency-conflict-resolution", version = "2.1.2" }
loom = { id = "dev.architectury.loom", version = "1.11.454" }
loom = { id = "dev.architectury.loom", version = "1.13.463" }
minotaur = { id = "com.modrinth.minotaur", version = "2.8.7" }
publishGithubRelease = { id = "ca.stellardrift.publish-github-release", version = "0.1.0" }
shadow = { id = "com.gradleup.shadow", version = "8.3.5" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }

[libraries.cuiProtocol-fabric]
module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-fabric-mc1.21.9"
module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-fabric-mc1.21.11"
version.ref = "cuiProtocol"

[libraries.cuiProtocol-neoforge]
module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-neoforge-mc1.21.9"
module = "org.enginehub.worldeditcui-protocol:worldeditcui-protocol-neoforge-mc1.21.11"
version.ref = "cuiProtocol"
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.util.profiling.Profiler;
import net.minecraft.util.profiling.ProfilerFiller;
import org.enginehub.worldeditcui.WorldEditCUI;
import org.enginehub.worldeditcui.render.BufferBuilderRenderSink;
import org.enginehub.worldeditcui.render.LineStyle;
import org.enginehub.worldeditcui.render.PipelineProvider;
import org.enginehub.worldeditcui.render.RenderSink;
Expand Down Expand Up @@ -98,7 +99,7 @@ public void onRender(final float partialTicks) {
}
final ProfilerFiller profiler = Profiler.get();
profiler.push("worldeditcui");
this.ctx.init(new Vector3(this.minecraft.gameRenderer.getMainCamera().getPosition()), partialTicks, sink);
this.ctx.init(new Vector3(this.minecraft.gameRenderer.getMainCamera().position()), partialTicks, sink);
final GpuBufferSlice fogStart = RenderSystem.getShaderFog();
RenderSystem.setShaderFog(this.minecraft.gameRenderer.fogRenderer.getBuffer(FogRenderer.FogMode.NONE));
final Matrix4fStack poseStack = RenderSystem.getModelViewStack();
Expand All @@ -113,7 +114,7 @@ public void onRender(final float partialTicks) {
GlConst.toGl(SourceFactor.SRC_ALPHA),
GlConst.toGl(DestFactor.ONE_MINUS_SRC_ALPHA));
GlStateManager._depthMask(true);
RenderSystem.lineWidth(LineStyle.DEFAULT_WIDTH);
BufferBuilderRenderSink.LineWidth.set(LineStyle.DEFAULT_WIDTH);

try {
this.controller.renderSelections(this.ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.Level;
import org.enginehub.worldeditcui.WorldEditCUI;
import org.enginehub.worldeditcui.config.CUIConfiguration;
Expand Down Expand Up @@ -50,7 +50,7 @@ public final class FabricModWorldEditCUI implements ModInitializer {
private static FabricModWorldEditCUI instance;

private static final KeyMapping.Category KEYBIND_CATEGORY_WECUI
= new KeyMapping.Category(ResourceLocation.fromNamespaceAndPath(MOD_ID, "general"));
= new KeyMapping.Category(Identifier.fromNamespaceAndPath(MOD_ID, "general"));

private final KeyMapping keyBindToggleUI = key("toggle", GLFW.GLFW_KEY_UNKNOWN);
private final KeyMapping keyBindClearSel = key("clear", GLFW.GLFW_KEY_UNKNOWN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
package org.enginehub.worldeditcui.render;

import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexFormat;
Expand Down Expand Up @@ -54,18 +52,16 @@ public BufferBuilderRenderSink(final TypeFactory types, final Runnable preFlush,
this.postFlush = postFlush;
}

static class LineWidth {
public static class LineWidth {
private static final boolean HAS_COMPATIBILITY = (GL11.glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK) & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
private static float lineWidth = GL11.glGetInteger(GL11.GL_LINE_WIDTH);

static void set(final float width) {
if (HAS_COMPATIBILITY) {
if (lineWidth != width) {
GL11.glLineWidth(width);
lineWidth = width;
}
public static void set(final float width) {
if (HAS_COMPATIBILITY && lineWidth != width) {
GL11.glLineWidth(width);
}
RenderSystem.lineWidth(width);

lineWidth = width;
}

}
Expand Down Expand Up @@ -112,12 +108,12 @@ public RenderSink vertex(final double x, final double y, final double z) {
// duplicate last
if (this.canLoop) {
final Vector3f normal = this.activeRenderType.hasNormals ? this.computeNormal(this.loopX, this.loopY, this.loopZ, x, y, z) : null;
builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a);
builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
if (normal != null) {
// we need to compute normals pointing directly towards the screen
builder.setNormal(normal.x(), normal.y(), normal.z());
}
builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a);
builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
if (normal != null) {
builder.setNormal(normal.x(), normal.y(), normal.z());
}
Expand All @@ -134,11 +130,11 @@ public RenderSink vertex(final double x, final double y, final double z) {
// we buffer vertices so we can compute normals here
if (this.canLoop) {
final Vector3f normal = this.activeRenderType.hasNormals ? this.computeNormal(this.loopX, this.loopY, this.loopZ, x, y, z) : null;
builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a);
builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
if (normal != null) {
builder.setNormal(normal.x(), normal.y(), normal.z());
}
builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a);
builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
if (normal != null) {
builder.setNormal(normal.x(), normal.y(), normal.z());
}
Expand All @@ -150,7 +146,7 @@ public RenderSink vertex(final double x, final double y, final double z) {
this.canLoop = true;
}
} else {
builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a);
builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
}
return this;
}
Expand Down Expand Up @@ -178,12 +174,12 @@ public RenderSink endLineLoop() {
if (this.canLoop) {
this.canLoop = false;
final Vector3f normal = this.activeRenderType.hasNormals ? this.computeNormal(this.loopX, this.loopY, this.loopZ, this.loopFirstX, this.loopFirstY, this.loopFirstZ) : null;
this.builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a);
this.builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
if (normal != null) {
this.builder.setNormal(normal.x(), normal.y(), normal.z());
}

this.builder.addVertex(this.loopFirstX, this.loopFirstY, this.loopFirstZ).setColor(this.r, this.g, this.b, this.a);
this.builder.addVertex(this.loopFirstX, this.loopFirstY, this.loopFirstZ).setColor(this.r, this.g, this.b, this.a).setLineWidth(LineWidth.lineWidth);
if (normal != null) {
this.builder.setNormal(normal.x(), normal.y(), normal.z());
}
Expand Down Expand Up @@ -267,9 +263,9 @@ public static class RenderType {
private final VertexFormat.Mode mode;
private final VertexFormat format;
private final boolean hasNormals;
private final net.minecraft.client.renderer.RenderType type;
private final net.minecraft.client.renderer.rendertype.RenderType type;

public RenderType(final VertexFormat.Mode mode, final VertexFormat format, @Nullable final net.minecraft.client.renderer.RenderType renderPipeline) {
public RenderType(final VertexFormat.Mode mode, final VertexFormat format, @Nullable final net.minecraft.client.renderer.rendertype.RenderType renderPipeline) {
this.mode = mode;
this.format = format;
this.hasNormals = format.getElementAttributeNames().contains("Normal");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.rendertype.RenderSetup;
import net.minecraft.client.renderer.rendertype.RenderType;
import net.minecraft.client.renderer.rendertype.RenderTypes;

public final class VanillaPipelineProvider implements PipelineProvider {

public static class DefaultTypeFactory implements BufferBuilderRenderSink.TypeFactory {
public static final DefaultTypeFactory INSTANCE = new DefaultTypeFactory();
private static final RenderSetup QUADS_SETUP = RenderSetup.builder(
RenderPipeline.builder(RenderPipeline.builder(RenderPipelines.MATRICES_PROJECTION_SNIPPET)
.withVertexShader("core/position_color")
.withFragmentShader("core/position_color")
.withBlend(BlendFunction.TRANSLUCENT)
.withVertexFormat(DefaultVertexFormat.POSITION_COLOR, VertexFormat.Mode.QUADS)
.buildSnippet())
.withLocation("pipeline/wecui_quads").withCull(false).build()
).bufferSize(1536).sortOnUpload().createRenderSetup();
private static final BufferBuilderRenderSink.RenderType QUADS = new BufferBuilderRenderSink.RenderType(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR,
RenderType.create("quads", 1536, false, true,
RenderPipeline.builder(RenderPipeline.builder(RenderPipelines.MATRICES_PROJECTION_SNIPPET)
.withVertexShader("core/position_color")
.withFragmentShader("core/position_color")
.withBlend(BlendFunction.TRANSLUCENT)
.withVertexFormat(DefaultVertexFormat.POSITION_COLOR, VertexFormat.Mode.QUADS)
.buildSnippet())
.withLocation("pipeline/wecui_quads").withCull(false).build(),
RenderType.CompositeState.builder().createCompositeState(false)
));
private static final BufferBuilderRenderSink.RenderType LINES = new BufferBuilderRenderSink.RenderType(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL, RenderType.LINES);
private static final BufferBuilderRenderSink.RenderType LINES_LOOP = new BufferBuilderRenderSink.RenderType(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL, RenderType.LINES);
RenderType.create("quads", QUADS_SETUP)
);
private static final BufferBuilderRenderSink.RenderType LINES = new BufferBuilderRenderSink.RenderType(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL_LINE_WIDTH, RenderTypes.LINES);
private static final BufferBuilderRenderSink.RenderType LINES_LOOP = new BufferBuilderRenderSink.RenderType(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL_LINE_WIDTH, RenderTypes.LINES);

private DefaultTypeFactory() {}

Expand Down
Loading