diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index e765c63f8a..104c928f19 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -280,6 +280,10 @@ public net.minecraft.world.item.crafting.Ingredient$TagValue public net.minecraft.world.item.crafting.Ingredient$TagValue (Lnet/minecraft/tags/TagKey;)V # constructor public net.minecraft.world.item.crafting.Ingredient$Value public net.minecraft.world.level.GameRules m_46189_(Ljava/lang/String;Lnet/minecraft/world/level/GameRules$Category;Lnet/minecraft/world/level/GameRules$Type;)Lnet/minecraft/world/level/GameRules$Key; # register +public net.minecraft.world.level.GameRules$BooleanValue m_46252_(ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create +public net.minecraft.world.level.GameRules$BooleanValue m_46250_(Z)Lnet/minecraft/world/level/GameRules$Type; # create +public net.minecraft.world.level.GameRules$IntegerValue m_46294_(ILjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create +public net.minecraft.world.level.GameRules$IntegerValue m_46312_(I)Lnet/minecraft/world/level/GameRules$Type; # create public net.minecraft.world.level.Level f_46437_ # oRainLevel public net.minecraft.world.level.Level f_46438_ # rainLevel public net.minecraft.world.level.Level f_46439_ # oThunderLevel diff --git a/src/test/java/net/minecraftforge/debug/CustomGameRuleTest.java b/src/test/java/net/minecraftforge/debug/CustomGameRuleTest.java new file mode 100644 index 0000000000..17e44a5f32 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/CustomGameRuleTest.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.debug; + +import net.minecraft.world.level.GameRules; +import net.minecraftforge.fml.common.Mod; + +/** + * Simple test to ensure custom game rules can be registered correctly and used in game. + *

+ * To test these game rules use the following commands. + *
If the game rules are registered correctly, they should show up as auto-completion values and be able to be changed to valid values based on their types. + *
These game rules should also show up and be editable under the {@code Edit Game Rules} screen, when creating a new world. + *
{@code Create new world > More (tab) > Game Rules > Misc} + *

+ */ +@Mod(CustomGameRuleTest.TEST_ID) +public class CustomGameRuleTest +{ + public static final String TEST_ID = "custom_game_rule_test"; + public static final GameRules.Key CUSTOM_BOOLEAN_GAME_RULE = GameRules.register("%s:custom_boolean_game_rule".formatted(TEST_ID), GameRules.Category.MISC, GameRules.BooleanValue.create(true)); + public static final GameRules.Key CUSTOM_INTEGER_GAME_RULE = GameRules.register("%s:custom_integer_game_rule".formatted(TEST_ID), GameRules.Category.MISC, GameRules.IntegerValue.create(1337)); +} diff --git a/src/test/resources/META-INF/mods.toml b/src/test/resources/META-INF/mods.toml index 8a1fe56f7d..75c14c3962 100644 --- a/src/test/resources/META-INF/mods.toml +++ b/src/test/resources/META-INF/mods.toml @@ -28,6 +28,8 @@ modId="mdk_datagen" modId="crash_callable_test" [[mods]] modId="deferred_work_queue_test" +[[mods]] + modId="custom_game_rule_test" # LEGACY TEST CASES ###### The mods below are from the old test framework and need to be yeeted later again.