Skip to content

Commit

Permalink
updated to mc 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Globox1997 committed Aug 24, 2024
1 parent 3da3ff5 commit 8ca0c6d
Show file tree
Hide file tree
Showing 48 changed files with 468 additions and 286 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
21 # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-22.04, windows-2022]
Expand All @@ -33,7 +33,7 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 17
- name: set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt-hotspot'
java-version: 17
java-version: 21
cache: 'gradle'

- name: make gradle wrapper executable
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
### Changed:
- No pause nutrition screen
- Starter nutritions set to half
- Updated to mc 1.21
### Added:
-
13 changes: 5 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -48,22 +48,19 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
it.options.release = 21
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
rename { "${it}_${project.archivesBaseName}"}
}
}

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.24
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.2

# Mod Properties
mod_version=1.0.3
maven_group=net.nutritionz
archives_base_name=nutritionz

# Dependencies
fabric_version=0.90.7+1.20.1
cloth_config_version=11.0.99
mod_menu_version=7.0.0
fabric_version=0.102.1+1.21.1
cloth_config_version=15.0.130
mod_menu_version=11.0.1

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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,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 +202,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
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,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 +57,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 src/main/java/net/nutritionz/NutritionClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public void onInitializeClient() {
RenderInit.init();
NutritionClientPacket.init();
}

}
19 changes: 9 additions & 10 deletions src/main/java/net/nutritionz/data/NutritionLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

import net.minecraft.registry.entry.RegistryEntry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -38,7 +39,7 @@ public class NutritionLoader implements SimpleSynchronousResourceReloadListener

@Override
public Identifier getFabricId() {
return new Identifier("nutritionz", "loader");
return Identifier.of("nutritionz", "loader");
}

@Override
Expand All @@ -52,13 +53,13 @@ public void reload(ResourceManager manager) {
Iterator<String> iterator = data.keySet().iterator();
while (iterator.hasNext()) {
String itemId = iterator.next();
if (Registries.ITEM.get(new Identifier(itemId)).toString().equals("air")) {
if (Registries.ITEM.get(Identifier.of(itemId)).toString().equals("air")) {
LOGGER.info("{} is not a valid item identifier", itemId);
continue;
}

JsonObject jsonObject = data.get(itemId).getAsJsonObject();
Item item = Registries.ITEM.get(new Identifier(itemId));
Item item = Registries.ITEM.get(Identifier.of(itemId));
if (replaceList.containsKey(item)) {
continue;
}
Expand Down Expand Up @@ -133,11 +134,9 @@ public void reload(ResourceManager manager) {

private static void processEffects(JsonObject effectsJsonObject, HashMap<Integer, List<Object>> nutritionEffectsMap, int i) {
List<Object> list = new ArrayList<Object>();
Iterator<String> iterator = effectsJsonObject.keySet().iterator();

while (iterator.hasNext()) {
String effectId = iterator.next();
Identifier effectIdentifier = new Identifier(effectId);
for (String effectId : effectsJsonObject.keySet()) {
Identifier effectIdentifier = Identifier.of(effectId);

if (!Registries.STATUS_EFFECT.containsId(effectIdentifier) && !Registries.ATTRIBUTE.containsId(effectIdentifier)) {
LOGGER.info("{} is not a valid status effect identifier nor attribute identifier", effectIdentifier);
Expand All @@ -146,11 +145,11 @@ private static void processEffects(JsonObject effectsJsonObject, HashMap<Integer

JsonObject effectJsonObject = effectsJsonObject.get(effectId).getAsJsonObject();
if (Registries.STATUS_EFFECT.containsId(effectIdentifier)) {
list.add(new StatusEffectInstance(Registries.STATUS_EFFECT.get(effectIdentifier), effectJsonObject.get("duration").getAsInt(),
list.add(new StatusEffectInstance(Registries.STATUS_EFFECT.getEntry(effectIdentifier).get(), effectJsonObject.get("duration").getAsInt(),
effectJsonObject.has("amplifier") ? effectJsonObject.get("amplifier").getAsInt() : 0, false, false, true));
} else {
Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers = LinkedHashMultimap.create();
attributeModifiers.put(Registries.ATTRIBUTE.get(effectIdentifier), new EntityAttributeModifier(Registries.ATTRIBUTE.get(effectIdentifier).getTranslationKey(),
Multimap<RegistryEntry<EntityAttribute>, EntityAttributeModifier> attributeModifiers = LinkedHashMultimap.create();
attributeModifiers.put(Registries.ATTRIBUTE.getEntry(effectIdentifier).get(), new EntityAttributeModifier(effectIdentifier,
effectJsonObject.get("value").getAsFloat(), Operation.valueOf(effectJsonObject.get("operation").getAsString().toUpperCase())));
list.add(attributeModifiers);
}
Expand Down
Loading

0 comments on commit 8ca0c6d

Please sign in to comment.