Skip to content

Commit

Permalink
fix fabric error with 5.x and add neoforge metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Nov 30, 2024
1 parent f3b7ddb commit 3efcc75
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//
package org.incendo.cloud.fabric.internal;

import java.util.Objects;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
Expand All @@ -36,13 +37,21 @@
@DefaultQualifier(NonNull.class)
public final class CloudFabricEntrypoint implements ModInitializer {

@SuppressWarnings("EmptyCatch")
@Override
public void onInitialize() {
if (FabricLoader.getInstance().isModLoaded("adventure-platform-fabric")) {
ServerLifecycleEvents.SERVER_STARTING.register(AdventureSupport.get()::setupServer);
ServerLifecycleEvents.SERVER_STOPPED.register(AdventureSupport.get()::removeServer);
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
AdventureSupport.get().setupClient();
try {
Objects.requireNonNull(
Class.forName("net.kyori.adventure.platform.modcommon.MinecraftAudiences").getName()
);

ServerLifecycleEvents.SERVER_STARTING.register(AdventureSupport.get()::setupServer);
ServerLifecycleEvents.SERVER_STOPPED.register(AdventureSupport.get()::removeServer);
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
AdventureSupport.get().setupClient();
}
} catch (final ClassNotFoundException ignored) {
}
}
}
Expand Down
1 change: 1 addition & 0 deletions cloud-minecraft-modded-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
mappings(loom.officialMojangMappings())
compileOnly(libs.fabricLoader)

// todo: depend on common when deps fixed
modCompileOnly(libs.adventureFabric)

compileOnly(libs.cloud.minecraft.extras)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private void setupConverter() {
try {
ComponentMessageThrowableConverter.setup(this);
} catch (final LinkageError ignored) {
// cloud-minecraft-extras not present
}
}

Expand Down
6 changes: 6 additions & 0 deletions cloud-neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ versionRange = "[1.20.5,)"
ordering = "NONE"
side = "BOTH"

[[dependencies.cloud]]
modId = "adventure_platform_neoforge"
type = "optional"
ordering = "AFTER"
side = "BOTH"

[[mixins]]
config = "cloud.mixins.json"

0 comments on commit 3efcc75

Please sign in to comment.