mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-03-01 05:04:40 +01:00
Fix BufferBuilderReader endianness
- Set split ByteBuffer's order to that of the BufferBuilder's ByteBuffer in BufferBuilderReader - Move Fabric-only mixins from mixin.fabric to fabric.mixin and create separate mixin config
This commit is contained in:
parent
09f3c495e9
commit
a2b6c4fd9d
12 changed files with 39 additions and 16 deletions
|
@ -1,10 +1,16 @@
|
|||
package com.jozufozu.flywheel.fabric.helper;
|
||||
|
||||
import com.jozufozu.flywheel.mixin.fabric.BufferBuilderAccessor;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.jozufozu.flywheel.fabric.mixin.BufferBuilderAccessor;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
|
||||
public final class BufferBuilderHelper {
|
||||
public static void fixByteOrder(BufferBuilder self, ByteBuffer buffer) {
|
||||
buffer.order(((BufferBuilderAccessor) self).getBuffer().order());
|
||||
}
|
||||
|
||||
public static VertexFormat getVertexFormat(BufferBuilder self) {
|
||||
return ((BufferBuilderAccessor) self).getFormat();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.jozufozu.flywheel.fabric.helper;
|
||||
|
||||
import com.jozufozu.flywheel.mixin.fabric.VertexFormatAccessor;
|
||||
import com.jozufozu.flywheel.fabric.mixin.VertexFormatAccessor;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
|
||||
public final class VertexFormatHelper {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
package com.jozufozu.flywheel.mixin.fabric;
|
||||
package com.jozufozu.flywheel.fabric.mixin;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
@ -8,6 +10,9 @@ import com.mojang.blaze3d.vertex.VertexFormat;
|
|||
|
||||
@Mixin(BufferBuilder.class)
|
||||
public interface BufferBuilderAccessor {
|
||||
@Accessor("buffer")
|
||||
ByteBuffer getBuffer();
|
||||
|
||||
@Accessor("format")
|
||||
VertexFormat getFormat();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.jozufozu.flywheel.mixin.fabric;
|
||||
package com.jozufozu.flywheel.fabric.mixin;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.jozufozu.flywheel.mixin.fabric;
|
||||
package com.jozufozu.flywheel.fabric.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
|
@ -1,4 +1,4 @@
|
|||
package com.jozufozu.flywheel.mixin.fabric;
|
||||
package com.jozufozu.flywheel.fabric.mixin;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
|
@ -1,4 +1,4 @@
|
|||
package com.jozufozu.flywheel.mixin.fabric;
|
||||
package com.jozufozu.flywheel.fabric.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
|
@ -1,4 +1,4 @@
|
|||
package com.jozufozu.flywheel.mixin.fabric;
|
||||
package com.jozufozu.flywheel.fabric.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
@ -18,6 +18,7 @@ public class BufferBuilderReader {
|
|||
VertexFormat vertexFormat = BufferBuilderHelper.getVertexFormat(builder);
|
||||
Pair<BufferBuilder.DrawState, ByteBuffer> data = builder.popNextBuffer();
|
||||
buffer = data.getSecond();
|
||||
BufferBuilderHelper.fixByteOrder(builder, buffer);
|
||||
|
||||
formatSize = vertexFormat.getVertexSize();
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
]
|
||||
},
|
||||
"mixins": [
|
||||
"flywheel.mixins.json"
|
||||
"flywheel.mixins.json",
|
||||
"flywheel.fabric.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
|
|
17
src/main/resources/flywheel.fabric.mixins.json
Normal file
17
src/main/resources/flywheel.fabric.mixins.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.jozufozu.flywheel.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"BufferBuilderAccessor",
|
||||
"DebugScreenOverlayMixin",
|
||||
"Matrix4fMixin",
|
||||
"MinecraftMixin",
|
||||
"TextureAtlasMixin",
|
||||
"VertexFormatAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
|
@ -21,13 +21,6 @@
|
|||
"matrix.Matrix3fMixin",
|
||||
"matrix.Matrix4fMixin",
|
||||
"matrix.PoseStackMixin"
|
||||
,
|
||||
"fabric.BufferBuilderAccessor",
|
||||
"fabric.DebugScreenOverlayMixin",
|
||||
"fabric.Matrix4fMixin",
|
||||
"fabric.MinecraftMixin",
|
||||
"fabric.TextureAtlasMixin",
|
||||
"fabric.VertexFormatAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Add table
Reference in a new issue