Skip to content

Commit

Permalink
1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Sep 30, 2024
1 parent ae1e48d commit 2f27d2b
Show file tree
Hide file tree
Showing 51 changed files with 443 additions and 587 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ forge*changelog.txt

logs

runs

*.xcf
373 changes: 164 additions & 209 deletions build.gradle

Large diffs are not rendered by default.

51 changes: 18 additions & 33 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
#org.gradle.jvmargs=
org.gradle.daemon=false

org.gradle.debug=false

## Environment Properties

# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20.2
# Read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
# You can find the latest versions here: https://parchmentmc.org/docs/getting-started
neogradle.subsystems.parchment.minecraftVersion=1.20.3
neogradle.subsystems.parchment.mappingsVersion=2023.12.31

# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.20.4
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.1,1.20.2,1.20.3,1.20.4,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=48.1.0
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[48,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[48,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=official
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=1.20.2

minecraft_version_range=[1.20.4,1.21)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=20.4.237
# The Neo version range can use any version of Neo as bounds or match the loader version range
neo_version_range=[20.4,)
# The loader version range can only use the major version of Neo/FML as bounds
loader_version_range=[2,)

## Mod Properties

Expand All @@ -48,12 +33,12 @@ mod_name=RandomLoot 2
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=0.0.0
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=dev.marston.randomloot
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=Marston Connell
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=An RPG style loot system built from the ground up to make Minecraft loot feel more personal.
mod_description=An RPG style loot system built from the ground up to make Minecraft loot feel more personal.# Pack version - this changes each minecraft release, in general.
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,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
31 changes: 18 additions & 13 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/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,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# 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"'
# 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 @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
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 @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# 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.

# 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, 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
8 changes: 3 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
maven { url = 'https://maven.neoforged.net/releases' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.marston.randomloot;

import net.minecraft.core.registries.Registries;
import org.jetbrains.annotations.NotNull;

import com.google.common.base.Supplier;
Expand All @@ -13,15 +14,15 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.common.loot.LootModifier;
import net.minecraftforge.registries.ForgeRegistries;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.common.loot.LootModifier;
import net.neoforged.neoforge.registries.ForgeRegistries;

public class CaseModifier extends LootModifier {
private final Item item;

public static final Supplier<Codec<CaseModifier>> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create(
inst -> codecStart(inst).and(ForgeRegistries.ITEMS.getCodec().fieldOf("item").forGetter(m -> m.item))
inst -> codecStart(inst).and(Registries.ITEM..fieldOf("item").forGetter(m -> m.item))
.apply(inst, CaseModifier::new)));

protected CaseModifier(LootItemCondition[] conditionsIn, Item item) {
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/dev/marston/randomloot/Config.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package dev.marston.randomloot;

import dev.marston.randomloot.loot.modifiers.Modifier;
import dev.marston.randomloot.loot.modifiers.ModifierRegistry;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.neoforge.common.ModConfigSpec;
import net.neoforged.neoforge.common.ModConfigSpec.BooleanValue;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import dev.marston.randomloot.loot.modifiers.Modifier;
import dev.marston.randomloot.loot.modifiers.ModifierRegistry;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.config.ModConfigEvent;

@Mod.EventBusSubscriber(modid = RandomLootMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Config {
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();

private static ForgeConfigSpec.DoubleValue CASE_CHANCE;
private static ModConfigSpec.DoubleValue CASE_CHANCE;

private static ForgeConfigSpec.DoubleValue MOD_CHANCE;
private static ModConfigSpec.DoubleValue MOD_CHANCE;

private static ForgeConfigSpec.DoubleValue GOODNESS;
private static ModConfigSpec.DoubleValue GOODNESS;

static final ForgeConfigSpec SPEC = build();
static final ModConfigSpec SPEC = build();

public static ForgeConfigSpec build() {
public static ModConfigSpec build() {
init();
return BUILDER.build();
}
Expand All @@ -33,7 +33,7 @@ public static ForgeConfigSpec build() {
public static double ModChance;
public static double Goodness;

private static Map<String, ForgeConfigSpec.BooleanValue> MODIFIERS_ENABLED;
private static Map<String, ModConfigSpec.BooleanValue> MODIFIERS_ENABLED;
private static Map<String, Boolean> ModsEnabled;

public static void init() {
Expand All @@ -45,7 +45,7 @@ public static void init() {
BUILDER.pop();

BUILDER.push("Modifiers Enabled");
MODIFIERS_ENABLED = new HashMap<String, ForgeConfigSpec.BooleanValue>();
MODIFIERS_ENABLED = new HashMap<String, ModConfigSpec.BooleanValue>();

for (Entry<String, Modifier> entry : ModifierRegistry.Modifiers.entrySet()) {
String key = entry.getKey();
Expand Down
17 changes: 6 additions & 11 deletions src/main/java/dev/marston/randomloot/GenWiki.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package dev.marston.randomloot;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import dev.marston.randomloot.loot.modifiers.Modifier;
import dev.marston.randomloot.loot.modifiers.ModifierRegistry;
import net.minecraft.resources.ResourceLocation;

import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class GenWiki {

private static void write(String s, FileWriter f) throws IOException {
Expand Down
26 changes: 9 additions & 17 deletions src/main/java/dev/marston/randomloot/ModLootModifiers.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
package dev.marston.randomloot;

import com.mojang.serialization.Codec;

import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

public class ModLootModifiers {
public static final DeferredRegister<Codec<? extends IGlobalLootModifier>> LOOT_MODIFIER_SERIALIZERS = DeferredRegister
.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, RandomLootMod.MODID);

public static final RegistryObject<Codec<? extends IGlobalLootModifier>> ADD_ITEM = LOOT_MODIFIER_SERIALIZERS
.register("case_item", CaseModifier.CODEC);

public static void register(IEventBus bus) {
LOOT_MODIFIER_SERIALIZERS.register(bus);
}
// public static final DeferredRegister<Codec<? extends IGlobalLootModifier>> LOOT_MODIFIER_SERIALIZERS = DeferredRegister
// .create(BuiltInRegistries..GLOBAL_LOOT_MODIFIER_SERIALIZERS, RandomLootMod.MODID);
//
// public static final DeferredRegister<Codec<? extends IGlobalLootModifier>> ADD_ITEM = LOOT_MODIFIER_SERIALIZERS
// .register("case_item", CaseModifier.CODEC);

// public static void register(IEventBus bus) {
// LOOT_MODIFIER_SERIALIZERS.register(bus);
// }
}
Loading

0 comments on commit 2f27d2b

Please sign in to comment.