Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.4.6-forge' into 1.4.7-forge
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Oct 21, 2024
2 parents 2e37b31 + 71a121a commit 2aea900
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import com.diffplug.gradle.spotless.JavaExtension
plugins {
id 'java-library'
id 'com.diffplug.spotless' version "6.12.0"
id 'fabric-loom' version "1.6-SNAPSHOT" apply false // To use chocoloom, change the version to a commit hash
id 'legacy-looming' version "1.6-SNAPSHOT" apply false // Version must be the same as fabric-loom's
id 'fabric-loom' version "1.7-SNAPSHOT" apply false // To use chocoloom, change the version to a commit hash
id 'legacy-looming' version "1.7-SNAPSHOT" apply false // Version must be the same as fabric-loom's
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
}
Expand Down Expand Up @@ -175,9 +175,9 @@ modrinth {
projectId = "JpHZ1Cyv" // This can be the project ID or the slug. Either will work!
versionName = displayVersion
changelog = """
Ensure Forge always loads before Minecraft classes.
Fix crash on server.
Fix compatibility with forge servers.
Fix IC2 crash because of bad reflection again.\\
Add OptiFabric/OptiFine compatibility.\\
Don't load multiple variant of a mixin at the same time
"""
uploadFile = remapJar
gameVersions = [project.minecraft_version] // Must be an array, even with only one version
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ org.gradle.jvmargs=-Xmx2G
spasm_version=0.2

# Mod Properties
mod_version = 2.7.2
mod_version = 2.7.5
maven_group = fr.catcore
archives_base_name = fabricated-forge
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.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
22 changes: 13 additions & 9 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 @@ -83,7 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
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 Expand Up @@ -144,15 +148,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
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
6 changes: 5 additions & 1 deletion src/main/java/cpw/mods/fml/common/ModClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ public File[] getParentSources() {

try {
for (URL url : urls) {
files.add(new File(url.toURI()));
try {
files.add(new File(url.toURI()));
} catch (IllegalArgumentException ignored) {
System.err.println("Found non file url while getting sources from Knot classloader: " + url.toURI());
}
}

return files.toArray(new File[0]);
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/fr/catcore/fabricatedforge/ForgeModRemapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,12 @@ public void registerPostVisitors(VisitorInfos visitorInfos) {
);

// Forge added fields and methods
visitorInfos.registerMethodInvocation(
"net/minecraft/class_197",
"setBurnProperties",
"",
new VisitorInfos.FullClassMember(
"fr/catcore/fabricatedforge/forged/reflection/ReflectedBlock",
"setBurnProperties",
null
)
);
visitorInfos.registerFieldRef(
"net/minecraft/class_197",
"blockFireSpreadSpeed",
"",
new VisitorInfos.FullClassMember(
"fr/catcore/fabricatedforge/forged/reflection/ReflectedWorld",
"fr/catcore/fabricatedforge/forged/reflection/ReflectedBlock",
"blockFireSpreadSpeed",
null
)
Expand All @@ -153,7 +143,7 @@ public void registerPostVisitors(VisitorInfos visitorInfos) {
"blockFlammability",
"",
new VisitorInfos.FullClassMember(
"fr/catcore/fabricatedforge/forged/reflection/ReflectedWorld",
"fr/catcore/fabricatedforge/forged/reflection/ReflectedBlock",
"blockFlammability",
null
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package fr.catcore.fabricatedforge.mixin;

import fr.catcore.cursedmixinextensions.CursedMixinExtensions;
import fr.catcore.fabricatedforge.Constants;
import io.github.fabriccompatibiltylayers.modremappingapi.api.MappingUtils;
import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

Expand All @@ -19,9 +23,44 @@ public String getRefMapperConfig() {
return null;
}

private static List<String> OPTIFINE_OVERRIDES = Arrays.asList(
"ast",
"asv",
"atq",
"auv",
"baj",
"ban",
"bau",
"bav",
"bax",
"baz",
"bba",
"bbb",
"bbd",
"bbf",
"bbg",
"bce",
"bdz",
"ik",
"il",
"kc",
"kh",
"md"
);

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return true;
if (FabricLoader.getInstance().isModLoaded("optifabric")) {
if (OPTIFINE_OVERRIDES.contains(FabricLoader.getInstance().getMappingResolver()
.unmapClassName("official", targetClassName)) && !mixinClassName.endsWith("Accessor") && !mixinClassName.contains(".optifine.")) {
System.out.println("[Fabricated-Legacy-Forge] Mixin cancelled for Optifine compatibility: " + mixinClassName);
return false;
}

return true;
} else {
return !mixinClassName.contains(".optifine.");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.catcore.fabricatedforge.mixin.forgefml.block;

import cpw.mods.fml.common.registry.BlockProxy;
import fr.catcore.cursedmixinextensions.annotations.Public;
import fr.catcore.fabricatedforge.forged.reflection.ReflectedBlock;
import fr.catcore.fabricatedforge.mixininterface.IBlock;
import fr.catcore.fabricatedforge.mixininterface.IBlockWithEntity;
Expand Down Expand Up @@ -529,6 +530,11 @@ public boolean canDragonDestroy(World world, int x, int y, int z) {
return this.id != OBSIDIAN.id && this.id != END_STONE.id && this.id != BEDROCK.id;
}

@Public
private static void setBurnProperties(int id, int encouragement, int flammability) {
ReflectedBlock.setBurnProperties(id, encouragement, flammability);
}

@Override
public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return this.id == EMERALD_BLOCK.id || this.id == GOLD_BLOCK.id || this.id == DIAMOND_BLOCK.id || this.id == IRON_BLOCK.id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client.render;

import com.mojang.blaze3d.platform.GLX;
import fr.catcore.cursedmixinextensions.annotations.Public;
import fr.catcore.fabricatedforge.mixininterface.ITessellator;
import net.minecraft.client.render.Tessellator;
import org.lwjgl.opengl.ARBVertexBufferObject;
Expand Down Expand Up @@ -54,6 +55,7 @@ public abstract class TessellatorMixin implements ITessellator {
private static int nativeBufferSize = 0x200000;
private static int trivertsInBuffer = nativeBufferSize / 48 * 6;
// Should be public
@Public
private static boolean renderingWorldRenderer = false;
public boolean defaultTexture = false;
private int rawBufferSize = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client.render.optifine;

import fr.catcore.fabricatedforge.mixininterface.ITessellator;
import net.minecraft.client.render.Tessellator;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(Tessellator.class)
public abstract class TessellatorMixin implements ITessellator {
@SuppressWarnings("UnresolvedMixinReference")
@Shadow
public static boolean renderingWorldRenderer;

@SuppressWarnings("UnresolvedMixinReference")
@Shadow
public boolean defaultTexture;

@SuppressWarnings("UnresolvedMixinReference")
@Shadow
public int textureID;

@Override
public boolean defaultTexture() {
return this.defaultTexture;
}

@Override
public boolean renderingWorldRenderer() {
return renderingWorldRenderer;
}

@Override
public void renderingWorldRenderer(boolean bool) {
renderingWorldRenderer = bool;
}

@Override
public void setTextureID(int textureID) {
this.textureID = textureID;
}

@Override
public int getTextureID() {
return this.textureID;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package fr.catcore.fabricatedforge.mixin.forgefml.client.render.optifine;

import fr.catcore.fabricatedforge.mixininterface.IWorldRenderer;
import net.minecraft.client.render.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(WorldRenderer.class)
public abstract class WorldRendererMixin implements IWorldRenderer {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package fr.catcore.fabricatedforge.mixin.forgefml.entity.mob.optifine;

import fr.catcore.fabricatedforge.mixininterface.IMobEntity;
import net.minecraft.entity.mob.MobEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(MobEntity.class)
public abstract class MobEntityMixin implements IMobEntity {

@Shadow
float field_3344;

@Override
public float getField_3344() {
return this.field_3344;
}

@Override
public void setField_3344(float field_3344) {
this.field_3344 = field_3344;
}
}
Loading

0 comments on commit 2aea900

Please sign in to comment.