Skip to content

Commit

Permalink
Fix guide export
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Dec 8, 2023
1 parent c1cf3f8 commit d1ee946
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 50 deletions.
83 changes: 37 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ dependencies {
transitive = false
}
// Used for the guide export
implementation("org.bytedeco:ffmpeg-platform:6.0-1.5.9")
implementation("org.bytedeco:ffmpeg-platform:${ffmpeg_version}")

implementation "net.neoforged:neoforge:${neoforge_version}"

Expand Down Expand Up @@ -328,44 +328,28 @@ import net.neoforged.gradle.userdev.runtime.tasks.ClasspathSerializer

import java.util.stream.Collectors

def libSrcSets = [
project(":libs:markdown").sourceSets.main
]

def legacyCPLibs = [
"io.methvin:directory-watcher:${directory_watcher_version}",
"org.yaml:snakeyaml:${snakeyaml_version}",
"com.google.flatbuffers:flatbuffers-java:${flatbuffers_version}",
]

tasks.withType(ClasspathSerializer).configureEach {
legacyCPLibs.each { lib ->
def libArtifact = lib.split(":")[1]
def libVersion = lib.split(":")[2]
def libJar = libArtifact + "-" + libVersion + ".jar"

def libFile = project.configurations.runtimeClasspath.find({
return it.name == libJar
})

it.inputFiles.from libFile
}
project.configurations.runtimeClasspath.each({f ->
if (f.name.startsWith("javacpp") || f.name.startsWith("ffmpeg")) {
it.inputFiles.from f
}
})
libSrcSets.each { srcSet ->
it.inputFiles.from srcSet.output
}
}

def commonRunProperties = {
workingDirectory = project.file('run')
systemProperties = commonSystemProperties
// property "mixin.debug.export", "true"
modSources = [sourceSets.main]
}
//
//tasks.withType(ClasspathSerializer).configureEach {
// legacyCPLibs.each { lib ->
// def libArtifact = lib.split(":")[1]
// def libVersion = lib.split(":")[2]
// def libJar = libArtifact + "-" + libVersion + ".jar"
//
// def libFile = project.configurations.runtimeClasspath.find({
// return it.name == libJar
// })
//
// it.inputFiles.from libFile
// }
// project.configurations.runtimeClasspath.each({f ->
// if (f.name.startsWith("javacpp") || f.name.startsWith("ffmpeg")) {
// it.inputFiles.from f
// }
// })
// libSrcSets.each { srcSet ->
// it.inputFiles.from srcSet.output
// }
//}

////////////////////
// Forge/Minecraft
Expand All @@ -376,8 +360,21 @@ minecraft {
}

runs {
configureEach {
workingDirectory = project.file('run')
systemProperties = commonSystemProperties
// property "mixin.debug.export", "true"
modSources = [sourceSets.main]

dependencies {
runtime project(":libs:markdown")
runtime "io.methvin:directory-watcher:${directory_watcher_version}"
runtime "org.yaml:snakeyaml:${snakeyaml_version}"
runtime "com.google.flatbuffers:flatbuffers-java:${flatbuffers_version}"
runtime "org.bytedeco:ffmpeg-platform:${ffmpeg_version}"
}
}
client {
with commonRunProperties
systemProperties = [
* : commonSystemProperties,
"appeng.tests" : "true",
Expand All @@ -386,26 +383,22 @@ runs {
}
gametestWorld {
configure("client")
with commonRunProperties
programArguments("--username", "AE2Dev", "--quickPlaySingleplayer", "GametestWorld")
systemProperties = [
"appeng.tests" : "true",
"guideDev.ae2guide.sources": file("guidebook").absolutePath,
]
}
guide {
with commonRunProperties
configure("client")
systemProperties = [
"guideDev.ae2guide.sources" : file("guidebook").absolutePath,
"guideDev.ae2guide.startupPage": "ae2:index.md"
]
}
server {
with commonRunProperties
}
data {
with commonRunProperties
programArguments = [
'--mod', 'ae2',
'--all',
Expand All @@ -414,7 +407,6 @@ runs {
]
}
guideexport {
with commonRunProperties
configure("client")
systemProperties = [
"appeng.runGuideExportAndExit": "true",
Expand All @@ -425,7 +417,6 @@ runs {
// Use to run the tests
gametest {
configure("gameTestServer")
with commonRunProperties
workingDirectory = project.file("build/gametest")
}
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ snakeyaml_version=1.33
directory_watcher_version=0.17.1
junit_version=5.10.1
flatbuffers_version=23.5.26
ffmpeg_version=6.0-1.5.9

#########################################################
# Gradle #
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/appeng/client/guidebook/scene/export/Mesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.VertexFormatElement;

import org.jetbrains.annotations.Nullable;
import org.joml.Vector2f;
import org.joml.Vector4i;

Expand All @@ -22,12 +23,20 @@

/**
* Captured rendering data.
*
* @param indexBuffer Can be null if {@link BufferBuilder.DrawState#sequentialIndex()} is true.
*/
record Mesh(BufferBuilder.DrawState drawState,
ByteBuffer vertexBuffer,
ByteBuffer indexBuffer,
@Nullable ByteBuffer indexBuffer,
RenderType renderType) {

Mesh {
if (indexBuffer == null && !drawState.sequentialIndex()) {
throw new NullPointerException("indexBuffer");
}
}

/**
* Checks if the mesh contains any texture atlases that are animated.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ public void endBatch(RenderType renderType) {
vertexBuffer.put(vbSource);
vertexBuffer.flip();

// Copy the index buffer
ByteBuffer indexBuffer = null;
var ibSource = buffer.indexBuffer();
var indexBuffer = ByteBuffer.allocate(ibSource.remaining());
indexBuffer.put(ibSource);
indexBuffer.flip();
if (ibSource != null) {
indexBuffer = ByteBuffer.allocate(ibSource.remaining());
indexBuffer.put(ibSource);
indexBuffer.flip();
}

this.meshes.add(new Mesh(
drawState,
Expand Down

0 comments on commit d1ee946

Please sign in to comment.