-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #674 from RakambdaOrg/nf
Add NeoForge support
- Loading branch information
Showing
40 changed files
with
2,015 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Forge bug report | ||
description: Create a report to help us improve the Forge version | ||
labels: ["modloader: Neoforge", "type: 🐛 bug"] | ||
assignees: | ||
- Rakambda | ||
body: | ||
- type: textarea | ||
id: describing | ||
attributes: | ||
label: Describe the bug | ||
description: Describe what happens and what you expected instead | ||
validations: | ||
required: true | ||
- type: input | ||
id: mc-version | ||
attributes: | ||
label: Minecraft version | ||
placeholder: 1.16.5 | ||
validations: | ||
required: true | ||
- type: input | ||
id: neoforge-version | ||
attributes: | ||
label: NeoForge version | ||
placeholder: 20.6.0 | ||
validations: | ||
required: true | ||
- type: input | ||
id: mod-version | ||
attributes: | ||
label: Mod version | ||
placeholder: 2.10.0 | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: config | ||
attributes: | ||
label: Configuration | ||
description: Please copy the content of the configuration file `fallingtree.json` | ||
render: json | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: logs | ||
attributes: | ||
label: Relevant log output | ||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. | ||
render: shell | ||
validations: | ||
required: false |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# gradle | ||
.gradle/ | ||
build/ | ||
run/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
plugins { | ||
id("java-library") | ||
alias(libs.plugins.neoforge) | ||
} | ||
|
||
runs { | ||
configureEach { | ||
systemProperty "forge.logging.markers", "REGISTRIES" | ||
systemProperty "forge.logging.console.level", "error" | ||
} | ||
|
||
client { | ||
// name "runFTNeoForgeClient" | ||
workingDirectory.set(project.file("./run/client")) | ||
} | ||
|
||
server { | ||
// taskName "runFTNeoForgeServer" | ||
workingDirectory.set(project.file("./run/server")) | ||
programArgument "--nogui" | ||
} | ||
|
||
gameTestServer { | ||
// taskName "runFTNeoForgeTestServer" | ||
workingDirectory.set(project.file("./run/test")) | ||
systemProperty "forge.enabledGameTestNamespaces", "fallingtree" | ||
} | ||
|
||
data { | ||
// taskName "runFTNeoForgeData" | ||
workingDirectory.set(project.file("./run/data")) | ||
programArguments.addAll '--mod', 'fallingtree', '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() | ||
} | ||
} | ||
|
||
minecraft { | ||
mappings { | ||
channel = official() | ||
version.put "minecraft", libs.versions.minecraftVersion.get() | ||
} | ||
|
||
accessTransformers.file('src/main/resources/META-INF/neoforge.accesstransformer.cfg') | ||
} | ||
|
||
sourceSets.main.resources { srcDir 'src/generated/resources' } | ||
|
||
dependencies { | ||
implementation(libs.neoforge) | ||
implementation(project(":common")) | ||
|
||
implementation("me.shedaniel.cloth:cloth-config-neoforge:${libs.versions.clothConfigVersion.get()}") | ||
} | ||
|
||
ext { | ||
minecraftVersion = libs.versions.minecraftVersion.get() | ||
} | ||
|
||
processResources { | ||
duplicatesStrategy = DuplicatesStrategy.INCLUDE | ||
|
||
from "src/main/resources", "../common/src/main/resources" | ||
|
||
filesMatching(["META-INF/neoforge.mods.toml"]) { | ||
expand project.properties | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
neoforge/src/main/java/fr/rakambda/fallingtree/neoforge/FallingTree.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package fr.rakambda.fallingtree.neoforge; | ||
|
||
import fr.rakambda.fallingtree.common.FallingTreeCommon; | ||
import fr.rakambda.fallingtree.neoforge.client.cloth.ClothConfigHook; | ||
import fr.rakambda.fallingtree.neoforge.common.FallingTreeCommonsImpl; | ||
import lombok.Getter; | ||
import lombok.extern.log4j.Log4j2; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.ModContainer; | ||
import net.neoforged.fml.ModList; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import org.jetbrains.annotations.NotNull; | ||
import java.lang.reflect.InvocationTargetException; | ||
|
||
@Log4j2 | ||
@Mod(FallingTree.MOD_ID) | ||
public class FallingTree{ | ||
public static final String MOD_ID = "fallingtree"; | ||
@Getter | ||
private static FallingTreeCommonsImpl mod; | ||
|
||
public FallingTree(@NotNull IEventBus modEventBus, @NotNull ModContainer modContainer){ | ||
mod = new FallingTreeCommonsImpl(modEventBus); | ||
|
||
if(ModList.get().isLoaded("cloth_config")){ | ||
try{ | ||
Class.forName("fr.rakambda.fallingtree.neoforge.client.cloth.ClothConfigHook") | ||
.asSubclass(ClothConfigHook.class) | ||
.getConstructor(FallingTreeCommon.class) | ||
.newInstance(mod) | ||
.load(modContainer); | ||
} | ||
catch(ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e){ | ||
log.error("Failed to hook into ClothConfig", e); | ||
} | ||
} | ||
|
||
mod.registerEnchant(); | ||
mod.registerForge(NeoForge.EVENT_BUS); | ||
} | ||
} |
Oops, something went wrong.