Skip to content

Commit

Permalink
Add forge support (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakambda authored Oct 27, 2024
1 parent 12f95ce commit 5f92a1a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 412 deletions.
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
minecraft(libs.forge)
library(project(":common"))

implementation("me.shedaniel.cloth:cloth-config-forge:${libs.versions.clothConfigVersion.get()}")
// implementation("me.shedaniel.cloth:cloth-config-forge:${libs.versions.clothConfigVersion.get()}")

// Hack fix for now, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
Expand Down
28 changes: 12 additions & 16 deletions forge/src/main/java/fr/rakambda/fallingtree/forge/FallingTree.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package fr.rakambda.fallingtree.forge;

import fr.rakambda.fallingtree.common.FallingTreeCommon;
import fr.rakambda.fallingtree.forge.client.cloth.ClothConfigHook;
import fr.rakambda.fallingtree.forge.common.FallingTreeCommonsImpl;
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import java.lang.reflect.InvocationTargetException;

@Log4j2
@Mod(FallingTree.MOD_ID)
Expand All @@ -18,18 +14,18 @@ public class FallingTree{
private static final FallingTreeCommonsImpl mod = new FallingTreeCommonsImpl();

public FallingTree(){
if(ModList.get().isLoaded("cloth_config")){
try{
Class.forName("fr.rakambda.fallingtree.forge.client.cloth.ClothConfigHook")
.asSubclass(ClothConfigHook.class)
.getConstructor(FallingTreeCommon.class)
.newInstance(mod)
.load();
}
catch(ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e){
log.error("Failed to hook into ClothConfig", e);
}
}
// if(ModList.get().isLoaded("cloth_config")){
// try{
// Class.forName("fr.rakambda.fallingtree.forge.client.cloth.ClothConfigHook")
// .asSubclass(ClothConfigHook.class)
// .getConstructor(FallingTreeCommon.class)
// .newInstance(mod)
// .load();
// }
// catch(ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e){
// log.error("Failed to hook into ClothConfig", e);
// }
// }

mod.registerForge(MinecraftForge.EVENT_BUS);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void sendMessage(@NotNull IComponent component, @NotNull NotificationMode
}
}
else{
raw.sendSystemMessage(text);
raw.displayClientMessage(text, true);
}
}

Expand Down
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[52,)"
loaderVersion = "[53,)"
issueTrackerURL = "https://github.com/${repoUser}/${repoName}/issues"
license = "LGPL-3.0"

Expand All @@ -15,7 +15,7 @@ authors = "Rakambda"
[[dependencies.fallingtree]]
modId = "forge"
mandatory = true
versionRange = "[52,)"
versionRange = "[53,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.fallingtree]]
Expand All @@ -27,6 +27,6 @@ side = "BOTH"
[[dependencies.fallingtree]]
modId = "cloth-config"
mandatory = false
versionRange = "[15.0.0,)"
versionRange = "[16.0.0,)"
ordering = "NONE"
side = "CLIENT"
2 changes: 1 addition & 1 deletion forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"description": {
"text": "FallingTree"
},
"pack_format": 34
"pack_format": 42
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.daemon=false
modId=fallingtree
modName=FallingTree
includeFabric=true
includeForge=false
includeForge=true
includeNeoForge=true
# Repository
repoUser=Rakambda
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ log4j2-version = "2.24.1"
minecraftVersion = "1.21.3"
fabric-loader-version = "0.16.7"
fabric-api-version = "0.106.1+1.21.3"
forge-version = "1.21.1-52.0.4"
forge-version = "1.21.3-53.0.4"
neoforge-version = "21.3.0-beta"

# Mod dependencies
Expand Down

0 comments on commit 5f92a1a

Please sign in to comment.