Skip to content

Commit

Permalink
Port to 1.20.1 Mostly complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
covers1624 committed Oct 16, 2023
1 parent b7f030b commit a621a04
Show file tree
Hide file tree
Showing 80 changed files with 788 additions and 1,232 deletions.
24 changes: 5 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url = "https://maven.minecraftforge.net/" }
maven { url = "https://repo.spongepowered.org/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}

plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id "net.covers1624.signing" version '1.1.4'
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: "org.spongepowered.mixin"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

group = 'codechicken'
Expand Down Expand Up @@ -106,7 +92,7 @@ repositories {
}

dependencies {
minecraft "net.minecraftforge:forge:${config.mc_version}-${config.forge_version}"
minecraft "net.neoforged:forge:${config.mc_version}-${config.forge_version}"

shadow 'net.covers1624:Quack:0.4.7.72'

Expand Down Expand Up @@ -151,7 +137,7 @@ def commonManifest = {
jar.enabled = false
shadowJar {
finalizedBy 'reobfShadowJar'
classifier = 'universal'
archiveClassifier = 'universal'
manifest commonManifest

configurations = [project.configurations.shadow]
Expand All @@ -161,7 +147,7 @@ shadowJar {
task srcJar(type: Jar) {
build.dependsOn it
from sourceSets.main.allSource
classifier = 'sources'
archiveClassifier = 'sources'
from file("LICENSE")
}

Expand Down
6 changes: 3 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mc_version=1.19.2
forge_version=43.2.0
mod_version=4.3.2
mc_version=1.20.1
forge_version=47.1.65
mod_version=4.4.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
25 changes: 18 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/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 All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# 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"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
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
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
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
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
Expand All @@ -205,6 +210,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
26 changes: 9 additions & 17 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
/*
* This settings file was auto generated by the Gradle buildInit task
* by 'sunstrike' at '21/11/13 14:14' with Gradle 1.9
*
* The settings file is used to specify which projects to include in your build.
* In a single project build this file can be empty or even removed.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at http://gradle.org/docs/1.9/userguide/multi_project_builds.html
*/

/*
// To declare projects as part of a multi-project build use the 'include' method
include 'shared'
include 'api'
include 'services:webservice'
*/
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
}
}

rootProject.name = 'CodeChickenLib'
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.19 2022-06-22T22:36:02.635898629 codechickenlib Languages: en_us
// 1.20.1 2023-09-08T20:35:35.335872512 codechickenlib Languages: en_us
ce1ce42a962941336b9de69689e94a97219ad7d9 assets/codechickenlib/lang/en_us.json
ce1ce42a962941336b9de69689e94a97219ad7d9 data/codechickenlib/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19 2022-06-22T22:36:02.63605193 CodeChickenLib Block tags.
// 1.20.1 2023-09-08T20:30:19.590475077 CodeChickenLib Block tags.
48ffc90719924738f43a8ea0c526941cbbb83318 data/forge/tags/blocks/wool.json
dc26d59698d238e0c60c400dbffea2ba82af4365 data/forge/tags/blocks/wool/black.json
4b007eca91284e115e6a0c208c8dddbbf0aed7bc data/forge/tags/blocks/wool/blue.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.19 2022-06-22T22:36:02.634627369 CodeChickenLib Item tags.
// 1.20.1 2023-09-08T20:30:19.593585402 CodeChickenLib Item tags.
48ffc90719924738f43a8ea0c526941cbbb83318 data/forge/tags/items/wool.json
dc26d59698d238e0c60c400dbffea2ba82af4365 data/forge/tags/items/wool/black.json
4b007eca91284e115e6a0c208c8dddbbf0aed7bc data/forge/tags/items/wool/blue.json
Expand Down
34 changes: 6 additions & 28 deletions src/main/java/codechicken/lib/CodeChickenLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@

import codechicken.lib.config.ConfigCategory;
import codechicken.lib.config.ConfigFile;
import codechicken.lib.datagen.ConditionalIngredient;
import codechicken.lib.internal.ClientInit;
import codechicken.lib.internal.command.CCLCommands;
import codechicken.lib.internal.network.CCLNetwork;
import codechicken.lib.internal.proxy.Proxy;
import codechicken.lib.internal.proxy.ProxyClient;
import codechicken.lib.datagen.ConditionalIngredient;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import java.nio.file.Paths;

Expand All @@ -28,31 +22,15 @@ public class CodeChickenLib {

public static ConfigCategory config;

public static Proxy proxy;

public CodeChickenLib() {
config = new ConfigFile(MOD_ID)
.path(Paths.get("config/ccl.cfg"))
.load();
proxy = DistExecutor.safeRunForDist(() -> ProxyClient::new, () -> Proxy::new);
FMLJavaModLoadingContext.get().getModEventBus().register(this);
CCLCommands.init();
ConditionalIngredient.Serializer.init();
}

@SubscribeEvent
public void onCommonSetup(FMLCommonSetupEvent event) {
proxy.commonSetup(event);
CCLNetwork.init();
}

@SubscribeEvent
public void onClientSetup(FMLClientSetupEvent event) {
proxy.clientSetup(event);
}
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> ClientInit::init);

@SubscribeEvent
public void onServerSetup(FMLDedicatedServerSetupEvent event) {
proxy.serverSetup(event);
CCLCommands.init();
CCLNetwork.init();
ConditionalIngredient.Serializer.init();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package codechicken.lib.block.component.data;

import net.minecraft.data.DataProvider;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.common.data.BlockTagsProvider;
import org.jetbrains.annotations.ApiStatus;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/codechicken/lib/data/MCDataInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Vector3;
import com.mojang.math.Vector3f;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.EncoderException;
Expand All @@ -25,6 +24,7 @@
import net.minecraftforge.registries.ForgeRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryManager;
import org.joml.Vector3f;

import javax.annotation.Nullable;
import java.io.DataInput;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/codechicken/lib/data/MCDataOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Vector3;
import com.mojang.math.Vector3f;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.EncoderException;
import net.minecraft.core.BlockPos;
Expand All @@ -19,6 +18,7 @@
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistry;
import net.minecraftforge.registries.IForgeRegistry;
import org.joml.Vector3f;

import java.io.DataOutput;
import java.io.DataOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ private static void onAddReloadListenerEvent(AddReloadListenerEvent event) {
public Ingredient parse(JsonObject json) {
if (!CraftingHelper.processConditions(json, "conditions", conditionContext)) {
if (json.has("fail")) {
return CraftingHelper.getIngredient(GsonHelper.getAsJsonObject(json, "fail"));
return CraftingHelper.getIngredient(GsonHelper.getAsJsonObject(json, "fail"), true);
}
return Ingredient.EMPTY;
}
return CraftingHelper.getIngredient(GsonHelper.getAsJsonObject(json, "pass"));
return CraftingHelper.getIngredient(GsonHelper.getAsJsonObject(json, "pass"), false);
}

// We don't operate like this, we always return a different ingredient.
Expand Down
Loading

0 comments on commit a621a04

Please sign in to comment.