improve build

- publish all modules
- add test mods to general runtime classpath

- fix issues with keybindings being registered before the game is initialized
This commit is contained in:
moehreag 2024-06-13 15:57:34 +02:00
parent ce633baa5d
commit b0b2555ebf
4 changed files with 23 additions and 5 deletions

View file

@ -19,6 +19,6 @@ jobs:
- name: Build - name: Build
run: | run: |
chmod +x ./gradlew chmod +x ./gradlew
./gradlew :publishMavenJavaPublicationToFrogMCSnapshotsMavenRepository \ ./gradlew publishMavenJavaPublicationToFrogMCSnapshotsMavenRepository \
-PFrogMCSnapshotsMavenUsername=${{ secrets.MAVEN_PUSH_USER }} \ -PFrogMCSnapshotsMavenUsername=${{ secrets.MAVEN_PUSH_USER }} \
-PFrogMCSnapshotsMavenPassword=${{ secrets.MAVEN_PUSH_TOKEN }} --stacktrace -PFrogMCSnapshotsMavenPassword=${{ secrets.MAVEN_PUSH_TOKEN }} --stacktrace

View file

@ -96,6 +96,15 @@ evaluationDependsOnChildren()
// TODO: add testmods of libraries to general client runtime classpath // TODO: add testmods of libraries to general client runtime classpath
tasks.runClient {
classpath(sourceSets.test.get().runtimeClasspath)
project.subprojects.filter {
it.projectDir.resolve("src/main/resources/frog.mod.toml").exists()
}.forEach {
classpath(it.sourceSets.test.get().output)
}
}
dependencies { dependencies {
project.subprojects.filter { project.subprojects.filter {
it.projectDir.resolve("src/main/resources/frog.mod.toml").exists() it.projectDir.resolve("src/main/resources/frog.mod.toml").exists()

View file

@ -1,7 +1,7 @@
[versions] [versions]
minecraft = "1.20.6" minecraft = "1.20.1"
frogloader = "0.0.1-SNAPSHOT" frogloader = "0.0.1-SNAPSHOT"
phytotelma = "0.0.1-alpha.4" phytotelma = "0.0.1-alpha.6"
lombok = "8.6" lombok = "8.6"

View file

@ -15,9 +15,18 @@ public class KeyMappingsImpl implements KeyMappings {
} }
public void registerKey(KeyMapping mapping){ public void registerKey(KeyMapping mapping){
// TODO maybe synchronize? Runnable register = () -> {
synchronized (Minecraft.getInstance().options) {
Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings, mapping); Minecraft.getInstance().options.keyMappings = ArrayUtils.add(Minecraft.getInstance().options.keyMappings, mapping);
} }
};
//noinspection ConstantValue (This inspection is just wrong)
if (Minecraft.getInstance() != null && Minecraft.getInstance().options != null) {
register.run();
} else {
Events.CLIENT_STARTUP.register((client, config) -> register.run());
}
}
@Override @Override
public void registerKeyWithListener(KeyMapping mapping, KeyListener listener) { public void registerKeyWithListener(KeyMapping mapping, KeyListener listener) {