Skip to content

Commit

Permalink
Merge pull request #36 from dima-dencep/neo
Browse files Browse the repository at this point in the history
Neoforge (1.21.1)
  • Loading branch information
KosmX authored Nov 28, 2024
2 parents 7977249 + 5ee01d8 commit 0119b77
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 48 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -36,7 +37,6 @@ public abstract class IModelPartMixin implements IModelPartAccessor {
*/
private ModelPartAccessor.Workaround workaround = ModelPartAccessor.Workaround.VanillaDraw;


@Override
public List<ModelPart.Cube> getCuboids() {
hasMutatedCuboid = true;
Expand All @@ -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<Void> original){
redirectedFunction(modelPart, entry, vertexConsumer, light, overlay, color, original);
}

/* // check what they do here
Expand All @@ -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<Void> 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){
Expand All @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""

Expand All @@ -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"
6 changes: 0 additions & 6 deletions forge/src/main/resources/pack.mcmeta

This file was deleted.

11 changes: 5 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 0119b77

Please sign in to comment.