Skip to content

Commit

Permalink
Merge branch '1.20.3' into 1.20.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	buildscript/src/main/java/Buildscript.java
#	src/main/resources/fabric.mod.json
  • Loading branch information
IMS212 committed Feb 10, 2024
2 parents c6c2608 + 9024e6e commit b7152f4
Show file tree
Hide file tree
Showing 11 changed files with 506 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: java -Diris.release=true -jar brachyura-bootstrap-0.jar build

- name: Upload artifacts to Modrinth and GitHub
uses: Kir-Antipov/mc-publish@v3.2
uses: Kir-Antipov/mc-publish@v3.3
with:
modrinth-id: YL57xq9U
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
Expand All @@ -43,6 +43,6 @@ jobs:

loaders: fabric quilt

dependencies: sodium | depends | *
dependencies: sodium

version-resolver: latest # Defaults to selecting the latest compatible version of Minecraft, using the tag from the fabric.mod.json
4 changes: 2 additions & 2 deletions buildscript/src/main/java/Buildscript.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ public void getModDependencies(ModDependencyCollector d) {
if (CUSTOM_SODIUM) {
d.add(new JavaJarDependency(getProjectDir().resolve("custom_sodium").resolve(customSodiumName).toAbsolutePath(), null, new MavenId("me.jellysquid.mods", "sodium-fabric", customSodiumName.replace("sodium-fabric-", ""))), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME);
} else {
d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.1-0.5.7"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME);
d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.1-0.5.8"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME);
}
} else {
d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.1-0.5.7"), ModDependencyFlag.COMPILE);
d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.1-0.5.8"), ModDependencyFlag.COMPILE);
}
}

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

import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.VertexConsumer;
import me.jellysquid.mods.sodium.client.render.vertex.buffer.ExtendedBufferBuilder;
import me.jellysquid.mods.sodium.client.render.vertex.buffer.SodiumBufferBuilder;
import net.coderbot.batchedentityrendering.impl.ordering.GraphTranslucencyRenderOrderManager;
import net.coderbot.batchedentityrendering.impl.ordering.RenderOrderManager;
import net.coderbot.iris.fantastic.WrappingMultiBufferSource;
Expand Down Expand Up @@ -90,7 +92,16 @@ public VertexConsumer getBuffer(RenderType renderType) {
affinities.put(renderType, affinity);
}

return builders[affinity].getBuffer(renderType);
VertexConsumer buffer = builders[affinity].getBuffer(renderType);

if (buffer instanceof ExtendedBufferBuilder bufferBuilder) {
SodiumBufferBuilder replacement = bufferBuilder.sodium$getDelegate();
if (replacement != null) {
return replacement;
}
}

return buffer;
}

private void removeReady() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.memory.MemoryIntrinsics;
import net.coderbot.batchedentityrendering.impl.BufferBuilderExt;
import net.minecraft.util.Mth;
import org.lwjgl.system.MemoryUtil;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.VertexFormat;
Expand All @@ -18,7 +23,7 @@
import java.nio.ByteBuffer;
import java.util.List;

@Mixin(BufferBuilder.class)
@Mixin(value = BufferBuilder.class, priority = 1010)
public class MixinBufferBuilder_SegmentRendering implements BufferBuilderExt {
@Shadow
private ByteBuffer buffer;
Expand Down Expand Up @@ -53,7 +58,7 @@ public void splitStrip() {

private void duplicateLastVertex() {
int i = this.format.getVertexSize();
this.buffer.put(this.nextElementByte, this.buffer, this.nextElementByte - i, i);
MemoryIntrinsics.copyMemory(MemoryUtil.memAddress(this.buffer, this.nextElementByte - i), MemoryUtil.memAddress(this.buffer, this.nextElementByte), i);
this.nextElementByte += i;
++this.vertices;
this.ensureVertexCapacity();
Expand All @@ -71,4 +76,13 @@ private void duplicateLastVertex() {
duplicateLastVertex();
}
}

@Dynamic
@Inject(method = "sodium$moveToNextVertex", at = @At("RETURN"), require = 0)
private void batchedentityrendering$onNextSodium(CallbackInfo ci) {
if (dupeNextVertex) {
dupeNextVertex = false;
duplicateLastVertex();
}
}
}
Loading

0 comments on commit b7152f4

Please sign in to comment.