Skip to content

Commit

Permalink
changed to neoforge
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 10, 2024
1 parent 2a72e84 commit 3599218
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 36 deletions.
26 changes: 11 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,28 @@ plugins {
id 'dev.architectury.loom' version '1.6-SNAPSHOT'
}

loom {
forge {
mixinConfigs = ["mixins.playerabilitylib.common.json"]
}
}

def isCI = System.getenv("GITHUB_ACTION")
def isRELEASE = System.getenv("GITHUB_RELEASE")
def gitHash() {
String hash = System.getenv("GITHUB_SHA")
if (hash != null) return hash.substring(0,8)
return ""
}

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

repositories {
maven {
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
}

dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
forge "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
minecraft "net.minecraft:minecraft:$project.minecraft_version"
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$project.yarn_mappings:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$project.yarn_mappings_patch_version")
}
neoForge "net.neoforged:neoforge:$project.neoforge_version"
api "org.jetbrains:annotations:19.0.0"
}

Expand All @@ -41,7 +37,7 @@ java {
processResources {
inputs.property "version", project.mod_version

filesMatching("META-INF/mods.toml") {
filesMatching("META-INF/neoforge.mods.toml") {
expand "version": project.mod_version
}
}
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ org.gradle.jvmargs=-Xmx4G
# check these on https://fabricmc.net/use
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
forge_version=47.3.0
loom.platform=forge
neoforge_version=20.6.121
yarn_mappings_patch_version = 1.20.6+build.4
loom.platform=neoforge

# Mod Properties
mod_version = 1.9.0
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pluginManagement {
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.minecraftforge.net/" }
maven {
name = 'Quilt'
url = "https://maven.quiltmc.org/repository/release"
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
maven {
name = 'Cotton'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/ladysnake/pal/Pal.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.github.ladysnake.pal.impl.PalInternals;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraftforge.fml.common.Mod;
import net.neoforged.fml.common.Mod;
import org.jetbrains.annotations.Nullable;

import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
*/
package io.github.ladysnake.pal;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.Cancelable;
import net.neoforged.bus.api.ICancellableEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;

/**
* Callback interface for receiving ability enabling events.
*
* @see PlayerAbilityUpdatedEvent
*/
@Cancelable
public class PlayerAbilityEnableEvent extends PlayerEvent {
public class PlayerAbilityEnableEvent extends PlayerEvent implements ICancellableEvent {
PlayerAbility ability;
AbilitySource source;
public PlayerAbilityEnableEvent(PlayerEntity player, PlayerAbility playerAbility, AbilitySource source) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package io.github.ladysnake.pal;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;

/**
* Callback interface for receiving ability update events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtString;
import net.minecraft.util.Identifier;
import net.minecraftforge.common.MinecraftForge;
import net.neoforged.neoforge.common.NeoForge;

import java.util.SortedSet;
import java.util.TreeSet;
Expand Down Expand Up @@ -55,7 +55,7 @@ public SimpleAbilityTracker(PlayerAbility ability, PlayerEntity player) {
public void addSource(AbilitySource abilitySource) {
boolean wasEmpty = this.abilitySources.isEmpty();
if (this.abilitySources.add(abilitySource) && wasEmpty) {
if (!MinecraftForge.EVENT_BUS.post(new PlayerAbilityEnableEvent(this.player, this.ability, abilitySource))) {
if (!NeoForge.EVENT_BUS.post(new PlayerAbilityEnableEvent(this.player, this.ability, abilitySource)).isCanceled()) {
this.updateState(true);
this.sync();
}
Expand Down Expand Up @@ -98,7 +98,7 @@ public void refresh(boolean syncVanilla) {
*/
protected boolean shouldBeEnabled() {
for (AbilitySource abilitySource : this.abilitySources) {
if (!MinecraftForge.EVENT_BUS.post(new PlayerAbilityEnableEvent(this.player, this.ability, abilitySource))) {
if (!NeoForge.EVENT_BUS.post(new PlayerAbilityEnableEvent(this.player, this.ability, abilitySource)).isCanceled()) {
return true;
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public void load(NbtCompound tag) {
* @param enabled {@code true} if the ability should be enabled, {@code false} if it should be disabled
*/
protected void updateState(boolean enabled) {
MinecraftForge.EVENT_BUS.post(new PlayerAbilityUpdatedEvent(player, ability, enabled));
NeoForge.EVENT_BUS.post(new PlayerAbilityUpdatedEvent(player, ability, enabled));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/io/github/ladysnake/pal/impl/PalInternals.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import io.github.ladysnake.pal.PlayerAbility;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.loading.FMLPaths;
import net.neoforged.fml.loading.FMLPaths;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Contract;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
modLoader="javafml"
license="LGPL"
loaderVersion="[47,)"
loaderVersion="[2,)"
issueTrackerURL="https://github.com/Trins-mods/PlayerAbiityLib-forge/issues"

[[mods]]
Expand All @@ -12,14 +12,16 @@ credits="Pyrofab for the original PlayerAbilityLib."
authors="Trinsdar, Pyrofab"
description='''Your good pal, helping with mod compat'''
[[dependencies.playerabilitylib]]
modId="forge"
mandatory=true
versionRange="[47.1.0,)"
modId="neoforge"
type="required"
versionRange="[20.6,)"
ordering="AFTER"
side="BOTH"
[[dependencies.playerabilitylib]]
modId="minecraft"
mandatory=true
versionRange="[1.20.1,)"
versionRange="[1.20.6,)"
ordering="AFTER"
side="BOTH"
[[mixins]]
config = "mixins.playerabilitylib.common.json"

0 comments on commit 3599218

Please sign in to comment.