diff --git a/build.gradle b/build.gradle index 228f9fc..9f33b4e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" version "8.1.1" apply false id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false } architectury { @@ -30,7 +30,6 @@ subprojects { // The following line declares the mojmap mappings, you may use other mappings as well // mappings loom.officialMojangMappings() // The following line declares the yarn mappings you may select this one as well. - // mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" // forge is unusable mappings loom.officialMojangMappings() } } diff --git a/common/src/main/java/io/github/kosmx/bendylib/mixin/IModelPartMixin.java b/common/src/main/java/io/github/kosmx/bendylib/mixin/IModelPartMixin.java index 1143a22..4f74ee7 100644 --- a/common/src/main/java/io/github/kosmx/bendylib/mixin/IModelPartMixin.java +++ b/common/src/main/java/io/github/kosmx/bendylib/mixin/IModelPartMixin.java @@ -1,5 +1,7 @@ package io.github.kosmx.bendylib.mixin; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import io.github.kosmx.bendylib.ModelPartAccessor; @@ -10,7 +12,6 @@ import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Iterator; @@ -36,7 +37,6 @@ public abstract class IModelPartMixin implements IModelPartAccessor { */ private ModelPartAccessor.Workaround workaround = ModelPartAccessor.Workaround.VanillaDraw; - @Override public List getCuboids() { hasMutatedCuboid = true; @@ -62,9 +62,9 @@ private void copyTransformExtended(ModelPart part, CallbackInfo ci){ } - @Redirect(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;III)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/geom/ModelPart;compile(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lcom/mojang/blaze3d/vertex/VertexConsumer;III)V"), require = 0) //It might not find anything if OF already broke the game - private void redirectRenderCuboids(ModelPart modelPart, PoseStack.Pose entry, VertexConsumer vertexConsumer, int light, int overlay, int color){ - redirectedFunction(modelPart, entry, vertexConsumer, light, overlay, color); + @WrapOperation(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;III)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/geom/ModelPart;compile(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lcom/mojang/blaze3d/vertex/VertexConsumer;III)V"), require = 0) //It might not find anything if OF already broke the game + private void redirectRenderCuboids(ModelPart modelPart, PoseStack.Pose entry, VertexConsumer vertexConsumer, int light, int overlay, int color, Operation original){ + redirectedFunction(modelPart, entry, vertexConsumer, light, overlay, color, original); } /* // check what they do here @@ -75,19 +75,21 @@ private void redirectOF(ModelPart modelPart, MatrixStack.Entry entry, VertexCons }*/ @Unique - private void redirectedFunction(ModelPart modelPart, PoseStack.Pose entry, VertexConsumer vertexConsumer, int light, int overlay, int color) { + private void redirectedFunction(ModelPart modelPart, PoseStack.Pose entry, VertexConsumer vertexConsumer, int light, int overlay, int color, Operation original) { if(workaround == ModelPartAccessor.Workaround.ExportQuads){ for(ModelPart.Cube cuboid:cubes){ ((CuboidSideAccessor)cuboid).doSideSwapping(); //:D } - compile(entry, vertexConsumer, light, overlay, color); + + original.call(modelPart, entry, vertexConsumer, light, overlay, color); + for(ModelPart.Cube cuboid:cubes){ ((CuboidSideAccessor)cuboid).resetSides(); //:D } } else if(workaround == ModelPartAccessor.Workaround.VanillaDraw){ if(!hasMutatedCuboid || cubes.size() == 1 && ((MutableCuboid)cubes.get(0)).getActiveMutator() == null){ - compile(entry, vertexConsumer, light, overlay, color); + original.call(modelPart, entry, vertexConsumer, light, overlay, color); } else { for(ModelPart.Cube cuboid:cubes){ @@ -96,7 +98,7 @@ else if(workaround == ModelPartAccessor.Workaround.VanillaDraw){ } } else { - compile(entry, vertexConsumer, light, overlay, color); + original.call(modelPart, entry, vertexConsumer, light, overlay, color); } } diff --git a/forge/build.gradle b/forge/build.gradle index dfcca40..d809e8f 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -31,7 +31,7 @@ dependencies { processResources { inputs.property "version", project.version - filesMatching("META-INF/mods.toml") { + filesMatching("META-INF/neoforge.mods.toml") { expand "version": project.version } } diff --git a/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java b/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java index 282efdf..254cd25 100644 --- a/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java +++ b/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java @@ -1,22 +1,17 @@ package io.github.kosmx.bendylib.neoforge; import io.github.kosmx.bendylib.compat.tr7zw.TDSkinCompat; +import net.neoforged.api.distmarker.Dist; import net.neoforged.fml.ModList; import net.neoforged.fml.common.Mod; -import net.neoforged.fml.loading.FMLLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Mod("bendylib") +@Mod(value = "bendylib", dist = Dist.CLIENT) public class ForgeModInterface { public static Logger LOGGER = LoggerFactory.getLogger("bendy-lib"); public ForgeModInterface() { - if (!FMLLoader.getDist().isClient()) { - LOGGER.warn("You're loading a client-only mod on server-side"); - LOGGER.warn("Most likely it won't be a problem"); - } - if (ModList.get().isLoaded("skinlayers3d")) { LOGGER.info("Initializing 3D Skin Layers compatibility"); diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/neoforge.mods.toml similarity index 82% rename from forge/src/main/resources/META-INF/mods.toml rename to forge/src/main/resources/META-INF/neoforge.mods.toml index 45c9c10..b776c86 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/neoforge.mods.toml @@ -10,8 +10,7 @@ displayURL = "https://github.com/KosmX/bendy-lib" displayName = "Bendy lib" authors = "KosmX" description = ''' -Bendy API ported to Forge -But you should use Fabric or Quilt +Bending model parts ''' #logoFile = "" @@ -22,6 +21,6 @@ config = "bendylib.mixins.json" modId = "minecraft" type = "required" mandatory = true -versionRange = "[1.20.2,)" +versionRange = "[1.21,)" ordering = "NONE" side = "CLIENT" diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta deleted file mode 100644 index 7e89d48..0000000 --- a/forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "Example Mod", - "pack_format": 9 - } -} diff --git a/gradle.properties b/gradle.properties index 99d045a..a1389c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,14 @@ org.gradle.jvmargs=-Xmx4G -mod_version=5.0-rc2 +mod_version=5.0 maven_group=io.github.kosmx.bendy-lib archives_base_name=bendy-lib -minecraft_version=1.21 -yarn_mappings=1.21+build.2 -loader_version=0.15.11 +minecraft_version=1.21.1 +loader_version=0.16.9 #Fabric api -fabric_version=0.100.3+1.21 +fabric_version=0.109.0+1.21.1 #Forge thingy -forge_version=21.0.21-beta +forge_version=21.1.80 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd49..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle b/settings.gradle index e7682a5..5a5f8d2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,7 +2,6 @@ pluginManagement { repositories { maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.architectury.dev/" } - maven { url "https://maven.minecraftforge.net/" } maven { url "https://maven.neoforged.net/releases" } gradlePluginPortal() }