Skip to content
Open
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 .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
java: [ 17 ]
java: [ 21 ]
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21

- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
with:
name: ${{ github.event.repository.name }}-MC${{ needs.build.outputs.mc_version }}-${{ needs.build.outputs.mod_version }}
version: MC${{ needs.build.outputs.mc_version }}-${{ matrix.loader }}-${{ needs.build.outputs.mod_version }}
java: Java 17
java: Java 21

files: ${{ matrix.loader }}/build/libs/*.jar

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ subprojects {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

tasks {
Expand All @@ -75,7 +75,7 @@ subprojects {

withType<JavaCompile>().configureEach {
options.encoding = "utf-8"
options.release.set(17)
options.release.set(21)
}
}

Expand Down
6 changes: 3 additions & 3 deletions common/src/main/java/li/cil/manual/api/ManualScreenStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public interface ManualScreenStyle {
};

default ResourceLocation getWindowBackground() {
return new ResourceLocation(Constants.MOD_ID, "textures/gui/manual.png");
return ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "textures/gui/manual.png");
}

default ResourceLocation getScrollButtonTexture() {
return new ResourceLocation(Constants.MOD_ID, "textures/gui/scroll_button.png");
return ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "textures/gui/scroll_button.png");
}

default ResourceLocation getTabButtonTexture() {
return new ResourceLocation(Constants.MOD_ID, "textures/gui/tab_button.png");
return ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "textures/gui/tab_button.png");
}

default Rect2i getWindowRect() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public NamespaceDocumentProvider(final String namespace) {
@Override
public Optional<Document> getDocument(final String path, final String language) {
final ResourceManager resourceManager = Minecraft.getInstance().getResourceManager();
final ResourceLocation location = new ResourceLocation(namespace, basePath + path);
final ResourceLocation location = ResourceLocation.fromNamespaceAndPath(namespace, basePath + path);
return resourceManager.getResource(location).flatMap(resource -> {
try (final InputStream stream = resource.open()) {
final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charsets.UTF_8));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,18 @@ private void drawChar(final Matrix4f matrix, final VertexConsumer buffer, final
final float u = column * U_STEP;
final float v = row * V_STEP;

buffer.vertex(matrix, x, lineHeight(), 0)
.color(r, g, b, a)
.uv(u, v + V_SIZE)
.endVertex();
buffer.vertex(matrix, x + charWidth(), lineHeight(), 0)
.color(r, g, b, a)
.uv(u + U_SIZE, v + V_SIZE)
.endVertex();
buffer.vertex(matrix, x + charWidth(), 0, 0)
.color(r, g, b, a)
.uv(u + U_SIZE, v)
.endVertex();
buffer.vertex(matrix, x, 0, 0)
.color(r, g, b, a)
.uv(u, v)
.endVertex();
buffer.addVertex(matrix, x, lineHeight(), 0)
.setColor(r, g, b, a)
.setUv(u, v + V_SIZE);
buffer.addVertex(matrix, x + charWidth(), lineHeight(), 0)
.setColor(r, g, b, a)
.setUv(u + U_SIZE, v + V_SIZE);
buffer.addVertex(matrix, x + charWidth(), 0, 0)
.setColor(r, g, b, a)
.setUv(u + U_SIZE, v);
buffer.addVertex(matrix, x, 0, 0)
.setColor(r, g, b, a)
.setUv(u, v);
}

private int getCharIndex(final char ch) {
Expand All @@ -187,11 +183,11 @@ private static final class MutableInteger {
private static final class FontRenderTypes extends RenderType {
public static RenderType create(final ResourceLocation texture) {
return create(Constants.MOD_ID + "/bitmap_font",
DefaultVertexFormat.POSITION_COLOR_TEX,
DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP,
VertexFormat.Mode.QUADS, 256,
false, false,
CompositeState.builder()
.setShaderState(POSITION_COLOR_TEX_SHADER)
.setShaderState(POSITION_COLOR_TEX_LIGHTMAP_SHADER)
.setTextureState(new TextureStateShard(texture, false, false))
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setWriteMaskState(COLOR_WRITE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package li.cil.manual.api.render;

import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.Tesselator;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -29,8 +27,7 @@ public interface FontRenderer {
* @param argb the color to render the string with.
*/
default void draw(final GuiGraphics graphics, final CharSequence value, final int argb) {
final BufferBuilder builder = Tesselator.getInstance().getBuilder();
final MultiBufferSource.BufferSource buffer = MultiBufferSource.immediate(builder);
final MultiBufferSource.BufferSource buffer = graphics.bufferSource();
drawInBatch(value, argb, graphics.pose().last().pose(), buffer);
buffer.endBatch();
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/li/cil/manual/api/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class Constants {
// ----------------------------------------------------------------------- //

private static <T> ResourceKey<Registry<T>> key(final String name) {
return ResourceKey.createRegistryKey(new ResourceLocation(MOD_ID, name));
return ResourceKey.createRegistryKey(ResourceLocation.fromNamespaceAndPath(MOD_ID, name));
}

// ----------------------------------------------------------------------- //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.blaze3d.vertex.*;
import li.cil.manual.api.util.Constants;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -36,9 +37,8 @@ public static RenderType texture(final ResourceLocation location) {
.createCompositeState(false));
}

public static void draw(final RenderType renderType, final Consumer<VertexConsumer> callback) {
final BufferBuilder builder = Tesselator.getInstance().getBuilder();
final MultiBufferSource.BufferSource bufferSource = MultiBufferSource.immediate(builder);
public static void draw(final GuiGraphics graphics, final RenderType renderType, final Consumer<VertexConsumer> callback) {
final MultiBufferSource.BufferSource bufferSource = graphics.bufferSource();
final VertexConsumer buffer = bufferSource.getBuffer(renderType);

callback.accept(buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ public Optional<InteractiveSegment> render(final GuiGraphics graphics, final int
final boolean isHovered = mouseX >= x && mouseX <= x + width &&
mouseY >= y && mouseY <= y + height;
if (isHovered) {
DocumentRenderTypes.draw(DocumentRenderTypes.highlight(), (buffer) -> {
DocumentRenderTypes.draw(graphics, DocumentRenderTypes.highlight(), (buffer) -> {
final var matrix = pose.last().pose();

final float r = 0.2f, g = 0.4f, b = 0.6f, a = 0.25f;

buffer.vertex(matrix, 0, renderer.getHeight(), 0).color(r, g, b, a).endVertex();
buffer.vertex(matrix, renderer.getWidth(), renderer.getHeight(), 0).color(r, g, b, a).endVertex();
buffer.vertex(matrix, renderer.getWidth(), 0, 0).color(r, g, b, a).endVertex();
buffer.vertex(matrix, 0, 0, 0).color(r, g, b, a).endVertex();
buffer.addVertex(matrix, 0, renderer.getHeight(), 0).setColor(r, g, b, a);
buffer.addVertex(matrix, renderer.getWidth(), renderer.getHeight(), 0).setColor(r, g, b, a);
buffer.addVertex(matrix, renderer.getWidth(), 0, 0).setColor(r, g, b, a);
buffer.addVertex(matrix, 0, 0, 0).setColor(r, g, b, a);
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package li.cil.manual.client.document.segment;

import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.Tesselator;
import li.cil.manual.api.render.FontRenderer;
import li.cil.manual.client.document.DocumentRenderer;
import net.minecraft.client.gui.GuiGraphics;
Expand Down Expand Up @@ -80,8 +78,7 @@ public Optional<InteractiveSegment> render(final GuiGraphics graphics, final int
final Optional<InteractiveSegment> interactive = getInteractiveParent();
final ObjectReference<Optional<InteractiveSegment>> hovered = new ObjectReference<>(Optional.empty());

final BufferBuilder builder = Tesselator.getInstance().getBuilder();
final MultiBufferSource.BufferSource bufferSource = MultiBufferSource.immediate(builder);
final MultiBufferSource.BufferSource bufferSource = graphics.bufferSource();

forEachBlock(segmentX, lineHeight, documentWidth, block -> {
final int blockWidth = getStringWidth(block.chars);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.resources.ResourceLocation;

public final class MissingContentRenderer extends TextureContentRenderer implements InteractiveContentRenderer {
private static final ResourceLocation LOCATION_GUI_MANUAL_MISSING = new ResourceLocation(Constants.MOD_ID, "textures/gui/missing.png");
private static final ResourceLocation LOCATION_GUI_MANUAL_MISSING = ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "textures/gui/missing.png");

private final Component tooltip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public int getHeight() {

@Override
public void render(final GuiGraphics graphics, final int mouseX, final int mouseY) {
DocumentRenderTypes.draw(DocumentRenderTypes.texture(location), (buffer) -> {
DocumentRenderTypes.draw(graphics, DocumentRenderTypes.texture(location), (buffer) -> {
final var matrix = graphics.pose().last().pose();
buffer.vertex(matrix, 0, texture.height, 0).uv(0, 1).endVertex();
buffer.vertex(matrix, texture.width, texture.height, 0).uv(1, 1).endVertex();
buffer.vertex(matrix, texture.width, 0, 0).uv(1, 0).endVertex();
buffer.vertex(matrix, 0, 0, 0).uv(0, 0).endVertex();
buffer.addVertex(matrix, 0, texture.height, 0).setUv(0, 1);
buffer.addVertex(matrix, texture.width, texture.height, 0).setUv(1, 1);
buffer.addVertex(matrix, texture.width, 0, 0).setUv(1, 0);
buffer.addVertex(matrix, 0, 0, 0).setUv(0, 0);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public MatchResult matches(final ManualModel manual) {

@Override
protected Optional<ContentRenderer> doGetRenderer(final String data) {
final Item item = BuiltInRegistries.ITEM.get(new ResourceLocation(data));
final Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(data));
if (item != Items.AIR) {
return Optional.of(new ItemStackContentRenderer(new ItemStack(item)));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public MatchResult matches(final ManualModel manual) {

@Override
protected Optional<ContentRenderer> doGetRenderer(final String data) {
final ResourceLocation location = new ResourceLocation(data);
final ResourceLocation location = ResourceLocation.parse(data);
return BuiltInRegistries.ITEM.getTagNames()
.filter(key -> key.location().equals(location))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Optional<ContentRenderer> getRenderer(final String path) {
}

try {
return Optional.of(new TextureContentRenderer(new ResourceLocation(path)));
return Optional.of(new TextureContentRenderer(ResourceLocation.parse(path)));
} catch (final Throwable t) {
return Optional.of(new MissingContentRenderer(Strings.NO_SUCH_IMAGE));
}
Expand Down
4 changes: 0 additions & 4 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@ tasks {
expand(properties)
}
}

remapJar {
injectAccessWidener.set(true)
}
}
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"fabric-api": ">=${fabricApiVersion}",
"architectury": ">=${architecturyVersion}",
"minecraft": ">=${minecraftVersion}",
"java": ">=17"
"java": ">=21"
},
"custom": {
"mc-publish": {
Expand Down
1 change: 0 additions & 1 deletion forge/.gitignore

This file was deleted.

33 changes: 0 additions & 33 deletions forge/build.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion forge/gradle.properties

This file was deleted.

This file was deleted.

40 changes: 0 additions & 40 deletions forge/src/main/resources/META-INF/mods.toml

This file was deleted.

6 changes: 0 additions & 6 deletions forge/src/main/resources/pack.mcmeta

This file was deleted.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false

enabledPlatforms=fabric,forge,neoforge
enabledPlatforms=fabric,neoforge

modId=markdown_manual
mavenGroup=li.cil.markdown_manual
Expand Down
Loading