From eb2966ec89bc9fd8ca0b635c919af365e5cff7ce Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 11 Sep 2024 18:55:39 -0400 Subject: [PATCH 01/18] Add dev module --- fabric-api-dev/README.md | 75 ++++++++++++++++++ fabric-api-dev/build.gradle | 5 ++ .../java/net/fabricmc/fabric/FabricDev.java | 27 +++++++ .../fabric/mixin/ArgumentTypesMixin.java | 20 +++++ .../fabric/mixin/BlockAndItemMixin.java | 25 ++++++ .../fabricmc/fabric/mixin/BlockBoxMixin.java | 20 +++++ .../fabricmc/fabric/mixin/BootstrapMixin.java | 37 +++++++++ .../net/fabricmc/fabric/mixin/ChunkMixin.java | 20 +++++ .../fabric/mixin/CommandManagerMixin.java | 26 ++++++ .../fabric/mixin/EulaReaderMixin.java | 20 +++++ .../fabric/mixin/MinecraftServerMixin.java | 20 +++++ .../mixin/StructureTemplateManagerMixin.java | 20 +++++ .../net/fabricmc/fabric/mixin/UtilMixin.java | 35 ++++++++ .../fabricmc/fabric/mixin/WeightMixin.java | 20 +++++ .../resources/assets/fabric-api-dev/icon.png | Bin 0 -> 1579 bytes .../main/resources/fabric-api-dev.mixins.json | 21 +++++ .../src/main/resources/fabric.mod.json | 28 +++++++ gradle.properties | 1 + settings.gradle | 1 + 19 files changed, 421 insertions(+) create mode 100644 fabric-api-dev/README.md create mode 100644 fabric-api-dev/build.gradle create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java create mode 100644 fabric-api-dev/src/main/resources/assets/fabric-api-dev/icon.png create mode 100644 fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json create mode 100644 fabric-api-dev/src/main/resources/fabric.mod.json diff --git a/fabric-api-dev/README.md b/fabric-api-dev/README.md new file mode 100644 index 0000000000..a4db3a1c79 --- /dev/null +++ b/fabric-api-dev/README.md @@ -0,0 +1,75 @@ +`Weight#validate`: +- Argument: `fabric.dev.zeroWeightWarning` +- Default: true +- Logs an error when a weight is set to 0 + +`Bootstrap#logMissing`: +- Argument `fabric.dev.logMissingTranslations` +- Default: true +- Logs an error when a translation is missing + +`CommandManager#checkMissing`: +- Argument `fabric.dev.enableCommandArgumentLogging` +- Default: true +- Logs an error regarding argument ambiguity and throws an exception if an argument type is not registered + +`Block#` & `Item#`: +- Argument `fabric.dev.logConventionIssues` +- Default: true +- Logs an error if Block classes don't end with Block and if Item classes don't end with Item + +`EulaReader#` & `EulaReader#createEulaFile`: +- Argument: `fabric.dev.alwaysAgreeToEula` +- Default: false +- Note: By enabling this, you declare that you have agreed to the EULA. +- Skips creating the eula.txt file and always agrees to the EULA + +`MinecraftServer#tickWorlds`: +- Argument: `fabric.dev.tickTestManager` +- Default: false +- Ticks TestManager.INSTANCE + +`CommandManager#`: +- Argument: `fabric.dev.registerDebugCommands` +- Default: true +- Register's Minecraft's debug commands (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, WardenSpawnTrackerCommand, SpawnArmorTrimsCommand, ServerPackCommand) and if on the server DebugConfigCommand + +`CommandManager#execute`: +- Argument: `fabric.dev.enableCommandExceptionLogging` +- Default: true +- Logs an error if a command threw an exception + +`ArgumentTypes#register`: +- Argument: `fabric.dev.registerTestArguments` +- Default: false +- Register's test_argument and test_class command arguments + +`BlockBox#` +- Argument: `fabric.dev.throwOnInvalidBlockBoxes` +- Default: true +- Throw's an exception if a bounding box is invalid + +`Chunk#sampleHeightmap`: +- Argument: `fabric.dev.enable_unprimed_heightmap_logging` +- Default: true +- Logs an error if the heightmap is null + +`StructureTemplateManager#`: +- Argument: `fabric.dev.enableLoadingStructuresFromGameTests` +- Default: true +- Adds a provider to load structure templates from GameTest files + +`Util#getChoiceTypeInternal`: +- Argument: `fabric.dev.throwOnMissingDataFixers` +- Default: false +- Throw's an exception if a DataFixer isn't registered + +`Util#debugRunnable` & `Util#debugSupplier`: +- Argument: `fabric.dev.enableSupplierAndRunnableDebugging` +- Default: false +- Set's the current thread's name to the activeThreadName if debugRunnable or debugSupplier is called + +`Util#error` & `Util#throwOrPause`: +- Argument: `fabric.dev.enableExceptionIdePausing` +- Default: true +- Call's a method in which you should have a breakpoint to debug errors thrown with Util#error and exceptions thrown with Util#throwOrPause diff --git a/fabric-api-dev/build.gradle b/fabric-api-dev/build.gradle new file mode 100644 index 0000000000..64f55fd09e --- /dev/null +++ b/fabric-api-dev/build.gradle @@ -0,0 +1,5 @@ +version = getSubprojectVersion(project) + +testDependencies(project, [ + ':fabric-command-api-v2' +]) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java new file mode 100644 index 0000000000..3c7abb44fe --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java @@ -0,0 +1,27 @@ +package net.fabricmc.fabric; + +public class FabricDev { + public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning", true); + public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations", true); + public static final boolean LOG_CONVENTION_ISSUES = getProperty("logConventionIssues", true); + public static final boolean ALWAYS_AGREE_TO_EULA = getProperty("alwaysAgreeToEula", false); + public static final boolean TICK_TEST_MANAGER = getProperty("tickTestManager", false); + public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands", true); + public static final boolean REGISTER_TEST_ARGUMENTS = getProperty("registerTestArguments", false); + public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging", true); + public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging", true); + public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes", true); + public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging", true); + public static final boolean ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS = getProperty("enableLoadingStructuresFromGameTests", true); + public static final boolean THROW_ON_MISSING_DATA_FIXERS = getProperty("throwOnMissingDataFixers", false); + public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging", false); + public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing", true); + + private static boolean getProperty(String name, boolean defaultValue) { + try { + return "true".equalsIgnoreCase(System.getProperty(name)); + } catch (Throwable e) { + return defaultValue; + } + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java new file mode 100644 index 0000000000..7d8bc890b1 --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.command.argument.ArgumentTypes; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(ArgumentTypes.class) +public class ArgumentTypesMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.REGISTER_TEST_ARGUMENTS") + @ModifyExpressionValue(method = "register(Lnet/minecraft/registry/Registry;)Lnet/minecraft/command/argument/serialize/ArgumentSerializer;", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.REGISTER_TEST_ARGUMENTS; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java new file mode 100644 index 0000000000..68188ac71b --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java @@ -0,0 +1,25 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.block.Block; + +import net.minecraft.item.Item; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin({Block.class, Item.class}) +public class BlockAndItemMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.LOG_CONVENTION_ISSUES") + @ModifyExpressionValue(method = { + "(Lnet/minecraft/block/AbstractBlock$Settings;)V", + "(Lnet/minecraft/item/Item$Settings;)V" + }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.LOG_CONVENTION_ISSUES; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java new file mode 100644 index 0000000000..9985ff8e55 --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.util.math.BlockBox; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(BlockBox.class) +public class BlockBoxMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.THROW_ON_INVALID_BLOCK_BOXES") + @ModifyExpressionValue(method = "(IIIIII)V", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.THROW_ON_INVALID_BLOCK_BOXES; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java new file mode 100644 index 0000000000..56e6560877 --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java @@ -0,0 +1,37 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.Bootstrap; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import java.util.Set; +import java.util.function.Consumer; + +@Mixin(Bootstrap.class) +public class BootstrapMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add OR conditions for FabricDev.LOG_MISSING_TRANSLATIONS and FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING") + @ModifyExpressionValue(method = "logMissing", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.LOG_MISSING_TRANSLATIONS || FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING; + } + + @Dynamic("Only execute the forEach if FabricDev.LOG_MISSING_TRANSLATIONS is true") + @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Ljava/util/Set;forEach(Ljava/util/function/Consumer;)V")) + private static boolean fabric$wrapWithConditionTranslationWarnings(Set instance, Consumer consumer) { + return FabricDev.LOG_MISSING_TRANSLATIONS; + } + + @Dynamic("Only log command argument exceptions if FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING is true") + @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/command/CommandManager;checkMissing()V")) + private static boolean fabric$wrapWithConditionCommandArgumentWarnings() { + return FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java new file mode 100644 index 0000000000..da20009996 --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.world.chunk.Chunk; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(Chunk.class) +public class ChunkMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING") + @ModifyExpressionValue(method = "sampleHeightmap", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java new file mode 100644 index 0000000000..9a7c7c96ff --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java @@ -0,0 +1,26 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.server.command.CommandManager; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(CommandManager.class) +public class CommandManagerMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.REGISTER_DEBUG_COMMANDS") + @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.REGISTER_DEBUG_COMMANDS; + } + + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_COMMAND_EXCEPTION_LOGGING") + @ModifyExpressionValue(method = "execute", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule2(boolean original) { + return original || FabricDev.ENABLE_COMMAND_EXCEPTION_LOGGING; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java new file mode 100644 index 0000000000..278f6fc309 --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.server.dedicated.EulaReader; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(EulaReader.class) +public class EulaReaderMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ALWAYS_AGREE_TO_EULA") + @ModifyExpressionValue(method = {"", "createEulaFile"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.ALWAYS_AGREE_TO_EULA; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java new file mode 100644 index 0000000000..f769e1e55d --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.server.MinecraftServer; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(MinecraftServer.class) +public class MinecraftServerMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.TICK_TEST_MANAGER") + @ModifyExpressionValue(method = "tickWorlds", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.TICK_TEST_MANAGER; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java new file mode 100644 index 0000000000..b0881d7cbf --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.structure.StructureTemplateManager; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(StructureTemplateManager.class) +public class StructureTemplateManagerMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS") + @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java new file mode 100644 index 0000000000..03d406eebc --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java @@ -0,0 +1,35 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.util.Util; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(Util.class) +public class UtilMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.THROW_ON_MISSING_DATA_FIXERS") + @ModifyExpressionValue(method = "getChoiceTypeInternal", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.THROW_ON_MISSING_DATA_FIXERS; + } + + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING") + @ModifyExpressionValue(method = { + "debugRunnable(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", + "debugSupplier(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;" + }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule2(boolean original) { + return original || FabricDev.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; + } + + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_EXCEPTION_IDE_PAUSING") + @ModifyExpressionValue(method = {"error", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule3(boolean original) { + return original || FabricDev.ENABLE_EXCEPTION_IDE_PAUSING; + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java new file mode 100644 index 0000000000..33c752155e --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java @@ -0,0 +1,20 @@ +package net.fabricmc.fabric.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDev; + +import net.minecraft.util.collection.Weight; + +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(Weight.class) +public class WeightMixin { + @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ZERO_WEIGHT_WARNING") + @ModifyExpressionValue(method = "validate", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + return original || FabricDev.ZERO_WEIGHT_WARNING; + } +} diff --git a/fabric-api-dev/src/main/resources/assets/fabric-api-dev/icon.png b/fabric-api-dev/src/main/resources/assets/fabric-api-dev/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..2931efbf610873c0084debb8690902b0103d27fe GIT binary patch literal 1579 zcmbVMTWB0r7@iGm)TAXsYw<=rnU=;v=W=GRbL=!tc4Brl6GO7t2vVJ$IlDV#XU;e? z+r2ymsZdMQqAyaFLLUo;RumtE8Z@?uf_*4nP^4;o6fOFoSkN+o1$K?f2nE9_*b5G-l)AV)k5Qhb^- zU{V4ZnTKgnmXdpcB*Kg!W(1hvM2N&RO30x1u~eI9meGQGe@_?PDQq%q1CiV$8~M7 z?MQ_mOdqCh^a65Sv|ntwSXjV5se1;VK1|Kr8G7TQoQL&*ctt{L{fClG}xPK5k^yK3%T69N6J=>3jBqc zDNvZsrJ-yOXI^^mWf1cmY^XST)CVzIGjvEPENowmy}ax zvJ8_(Cf#+H-dBlH53`_u-~6BVAMz|(g?jCVdBWNZ(+A}(pFV7>S3QgPiQcMaflkIC z-3Ti|VT~{au*vq0ts9O&m$p&Gl=L6+q6_m$IcVq}o~+Pl{g>1esQp4%wp~|*zk1n` zZ7T6Toc4`y88s}riCP|ZXrJ?FLz@^KTcyqLjey zu95Yz%F&S{<0~f)Iomek?+hQ%MhCu%T^zsg>C_L`1`Br`xNY&))k9yTQb$JC>)w_f zpU(^tu^Q)y%W~lVz`jz;_ jF?g&s@Y=Qe&c#kW|JbvqK0Y=Rw)4XDoVqsk_>;c_`@;F@ literal 0 HcmV?d00001 diff --git a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json new file mode 100644 index 0000000000..be877406dc --- /dev/null +++ b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json @@ -0,0 +1,21 @@ +{ + "required": true, + "package": "net.fabricmc.fabric.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "ArgumentTypesMixin", + "BlockAndItemMixin", + "BlockBoxMixin", + "BootstrapMixin", + "ChunkMixin", + "CommandManagerMixin", + "EulaReaderMixin", + "MinecraftServerMixin", + "StructureTemplateManagerMixin", + "UtilMixin", + "WeightMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/fabric-api-dev/src/main/resources/fabric.mod.json b/fabric-api-dev/src/main/resources/fabric.mod.json new file mode 100644 index 0000000000..081780f7d2 --- /dev/null +++ b/fabric-api-dev/src/main/resources/fabric.mod.json @@ -0,0 +1,28 @@ +{ + "schemaVersion": 1, + "id": "fabric-api-dev", + "name": "Fabric API Dev Utilities", + "version": "${version}", + "environment": "*", + "license": "Apache-2.0", + "icon": "assets/fabric-api-dev/icon.png", + "contact": { + "homepage": "https://fabricmc.net", + "irc": "irc://irc.esper.net:6667/fabric", + "issues": "https://github.com/FabricMC/fabric/issues", + "sources": "https://github.com/FabricMC/fabric" + }, + "authors": [ + "FabricMC" + ], + "depends": { + "fabricloader": ">=0.15.11" + }, + "description": "Contains utilities for development environments.", + "mixins": [ + "fabric-api-dev.mixins.json" + ], + "custom": { + "fabric-api:module-lifecycle": "stable" + } +} diff --git a/gradle.properties b/gradle.properties index 51e867c005..a9182c2b3c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,7 @@ curseforge_minecraft_version=1.21.1 # Do not manually update, use the bumpversions task: fabric-api-base-version=0.4.42 +fabric-api-dev-version=0.0.1 fabric-api-lookup-api-v1-version=1.6.68 fabric-biome-api-v1-version=13.0.29 fabric-block-api-v1-version=1.0.22 diff --git a/settings.gradle b/settings.gradle index 540cbccdbf..d6a95ecb6b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,6 +14,7 @@ include 'fabric-api-bom' include 'fabric-api-catalog' include 'fabric-api-base' +include 'fabric-api-dev' include 'fabric-api-lookup-api-v1' include 'fabric-biome-api-v1' From f21777c2919a47774a976a650f53f6a1894ab3db Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 11 Sep 2024 18:59:08 -0400 Subject: [PATCH 02/18] remove dependency --- fabric-api-dev/build.gradle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fabric-api-dev/build.gradle b/fabric-api-dev/build.gradle index 64f55fd09e..85b5e378d4 100644 --- a/fabric-api-dev/build.gradle +++ b/fabric-api-dev/build.gradle @@ -1,5 +1 @@ version = getSubprojectVersion(project) - -testDependencies(project, [ - ':fabric-command-api-v2' -]) From 5e80e69b9ed73376a15c54059716361858f0f2ac Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 11 Sep 2024 20:11:55 -0400 Subject: [PATCH 03/18] run formatter --- .../java/net/fabricmc/fabric/FabricDev.java | 16 ++++++++++ .../fabric/mixin/ArgumentTypesMixin.java | 25 ++++++++++++---- .../fabric/mixin/BlockAndItemMixin.java | 26 ++++++++++++---- .../fabricmc/fabric/mixin/BlockBoxMixin.java | 25 ++++++++++++---- .../fabricmc/fabric/mixin/BootstrapMixin.java | 30 ++++++++++++++----- .../net/fabricmc/fabric/mixin/ChunkMixin.java | 25 ++++++++++++---- .../fabric/mixin/CommandManagerMixin.java | 25 ++++++++++++---- .../fabric/mixin/EulaReaderMixin.java | 25 ++++++++++++---- .../fabric/mixin/MinecraftServerMixin.java | 25 ++++++++++++---- .../mixin/StructureTemplateManagerMixin.java | 25 ++++++++++++---- .../net/fabricmc/fabric/mixin/UtilMixin.java | 25 ++++++++++++---- .../fabricmc/fabric/mixin/WeightMixin.java | 25 ++++++++++++---- 12 files changed, 238 insertions(+), 59 deletions(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java index 3c7abb44fe..cf1fa7dc04 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric; public class FabricDev { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java index 7d8bc890b1..0a85f6a8ed 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.command.argument.ArgumentTypes; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.command.argument.ArgumentTypes; + +import net.fabricmc.fabric.FabricDev; + @Mixin(ArgumentTypes.class) public class ArgumentTypesMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.REGISTER_TEST_ARGUMENTS") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java index 68188ac71b..b3adc8b89e 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java @@ -1,16 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; import net.minecraft.block.Block; - import net.minecraft.item.Item; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; +import net.fabricmc.fabric.FabricDev; @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java index 9985ff8e55..72e7160ad7 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.util.math.BlockBox; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.util.math.BlockBox; + +import net.fabricmc.fabric.FabricDev; + @Mixin(BlockBox.class) public class BlockBoxMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.THROW_ON_INVALID_BLOCK_BOXES") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java index 56e6560877..3a889cb54b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java @@ -1,19 +1,33 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import java.util.Set; +import java.util.function.Consumer; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.Bootstrap; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import java.util.Set; -import java.util.function.Consumer; +import net.minecraft.Bootstrap; + +import net.fabricmc.fabric.FabricDev; @Mixin(Bootstrap.class) public class BootstrapMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java index da20009996..e02817eaee 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.world.chunk.Chunk; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.world.chunk.Chunk; + +import net.fabricmc.fabric.FabricDev; + @Mixin(Chunk.class) public class ChunkMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java index 9a7c7c96ff..ed85b5dac6 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.server.command.CommandManager; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.server.command.CommandManager; + +import net.fabricmc.fabric.FabricDev; + @Mixin(CommandManager.class) public class CommandManagerMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.REGISTER_DEBUG_COMMANDS") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java index 278f6fc309..8df0cbf872 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.server.dedicated.EulaReader; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.server.dedicated.EulaReader; + +import net.fabricmc.fabric.FabricDev; + @Mixin(EulaReader.class) public class EulaReaderMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ALWAYS_AGREE_TO_EULA") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java index f769e1e55d..e39bad68cf 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.server.MinecraftServer; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.server.MinecraftServer; + +import net.fabricmc.fabric.FabricDev; + @Mixin(MinecraftServer.class) public class MinecraftServerMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.TICK_TEST_MANAGER") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java index b0881d7cbf..90a9d79ac0 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.structure.StructureTemplateManager; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.structure.StructureTemplateManager; + +import net.fabricmc.fabric.FabricDev; + @Mixin(StructureTemplateManager.class) public class StructureTemplateManagerMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java index 03d406eebc..5d66b379d9 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.util.Util; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.util.Util; + +import net.fabricmc.fabric.FabricDev; + @Mixin(Util.class) public class UtilMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.THROW_ON_MISSING_DATA_FIXERS") diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java index 33c752155e..2d65f9f8c2 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java @@ -1,15 +1,30 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package net.fabricmc.fabric.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.FabricDev; - -import net.minecraft.util.collection.Weight; - import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import net.minecraft.util.collection.Weight; + +import net.fabricmc.fabric.FabricDev; + @Mixin(Weight.class) public class WeightMixin { @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ZERO_WEIGHT_WARNING") From 09ac8f6497e92f031959804f9e5f043a3750201a Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 11 Sep 2024 20:20:02 -0400 Subject: [PATCH 04/18] make checkstyle happy? --- .../mixin/{ => dev}/ArgumentTypesMixin.java | 2 +- .../mixin/{ => dev}/BlockAndItemMixin.java | 2 +- .../fabric/mixin/{ => dev}/BlockBoxMixin.java | 2 +- .../mixin/{ => dev}/BootstrapMixin.java | 2 +- .../fabric/mixin/{ => dev}/ChunkMixin.java | 2 +- .../mixin/{ => dev}/CommandManagerMixin.java | 2 +- .../mixin/{ => dev}/EulaReaderMixin.java | 2 +- .../mixin/{ => dev}/MinecraftServerMixin.java | 2 +- .../StructureTemplateManagerMixin.java | 2 +- .../fabric/mixin/{ => dev}/UtilMixin.java | 2 +- .../fabric/mixin/{ => dev}/WeightMixin.java | 2 +- .../main/resources/fabric-api-dev.mixins.json | 22 +++++++++---------- 12 files changed, 22 insertions(+), 22 deletions(-) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/ArgumentTypesMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/BlockAndItemMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/BlockBoxMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/BootstrapMixin.java (98%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/ChunkMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/CommandManagerMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/EulaReaderMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/MinecraftServerMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/StructureTemplateManagerMixin.java (97%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/UtilMixin.java (98%) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/{ => dev}/WeightMixin.java (97%) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java index 0a85f6a8ed..637f73d6e8 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ArgumentTypesMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index b3adc8b89e..c6360f95b7 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index 72e7160ad7..fbf2063d02 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java similarity index 98% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index 3a889cb54b..3ad0ac998e 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import java.util.Set; import java.util.function.Consumer; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index e02817eaee..c428ae626f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index ed85b5dac6..1e2dd10bdb 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java index 8df0cbf872..8883c8b91c 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java index e39bad68cf..f8f488d571 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/MinecraftServerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java index 90a9d79ac0..2d2063abc7 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/StructureTemplateManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java similarity index 98% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 5d66b379d9..4085deb36f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java similarity index 97% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 2d65f9f8c2..61617b4846 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.mixin; +package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Dynamic; diff --git a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json index be877406dc..36fc3ad60f 100644 --- a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json +++ b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json @@ -3,17 +3,17 @@ "package": "net.fabricmc.fabric.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "ArgumentTypesMixin", - "BlockAndItemMixin", - "BlockBoxMixin", - "BootstrapMixin", - "ChunkMixin", - "CommandManagerMixin", - "EulaReaderMixin", - "MinecraftServerMixin", - "StructureTemplateManagerMixin", - "UtilMixin", - "WeightMixin" + "dev.ArgumentTypesMixin", + "dev.BlockAndItemMixin", + "dev.BlockBoxMixin", + "dev.BootstrapMixin", + "dev.ChunkMixin", + "dev.CommandManagerMixin", + "dev.EulaReaderMixin", + "dev.MinecraftServerMixin", + "dev.StructureTemplateManagerMixin", + "dev.UtilMixin", + "dev.WeightMixin" ], "injectors": { "defaultRequire": 1 From 902e83e2eb8545bf8366890cbb591c0342e837d6 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 13 Sep 2024 15:37:48 -0400 Subject: [PATCH 05/18] First set of review fixes --- fabric-api-dev/README.md | 22 +----------- .../java/net/fabricmc/fabric/FabricDev.java | 6 +--- .../fabric/mixin/dev/ArgumentTypesMixin.java | 35 ------------------- .../fabric/mixin/dev/BlockAndItemMixin.java | 3 +- .../fabric/mixin/dev/BlockBoxMixin.java | 3 +- .../fabric/mixin/dev/BootstrapMixin.java | 13 +++---- .../fabricmc/fabric/mixin/dev/ChunkMixin.java | 3 +- .../fabric/mixin/dev/CommandManagerMixin.java | 6 ++-- .../fabric/mixin/dev/EulaReaderMixin.java | 3 +- .../mixin/dev/MinecraftServerMixin.java | 35 ------------------- .../dev/StructureTemplateManagerMixin.java | 35 ------------------- .../fabricmc/fabric/mixin/dev/UtilMixin.java | 14 ++------ .../fabric/mixin/dev/WeightMixin.java | 3 +- .../main/resources/fabric-api-dev.mixins.json | 21 +++++------ 14 files changed, 26 insertions(+), 176 deletions(-) delete mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java delete mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java delete mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java diff --git a/fabric-api-dev/README.md b/fabric-api-dev/README.md index a4db3a1c79..65d728a35f 100644 --- a/fabric-api-dev/README.md +++ b/fabric-api-dev/README.md @@ -24,11 +24,6 @@ - Note: By enabling this, you declare that you have agreed to the EULA. - Skips creating the eula.txt file and always agrees to the EULA -`MinecraftServer#tickWorlds`: -- Argument: `fabric.dev.tickTestManager` -- Default: false -- Ticks TestManager.INSTANCE - `CommandManager#`: - Argument: `fabric.dev.registerDebugCommands` - Default: true @@ -39,31 +34,16 @@ - Default: true - Logs an error if a command threw an exception -`ArgumentTypes#register`: -- Argument: `fabric.dev.registerTestArguments` -- Default: false -- Register's test_argument and test_class command arguments - `BlockBox#` - Argument: `fabric.dev.throwOnInvalidBlockBoxes` - Default: true - Throw's an exception if a bounding box is invalid `Chunk#sampleHeightmap`: -- Argument: `fabric.dev.enable_unprimed_heightmap_logging` +- Argument: `fabric.dev.enableUnprimedHeightmapLogging` - Default: true - Logs an error if the heightmap is null -`StructureTemplateManager#`: -- Argument: `fabric.dev.enableLoadingStructuresFromGameTests` -- Default: true -- Adds a provider to load structure templates from GameTest files - -`Util#getChoiceTypeInternal`: -- Argument: `fabric.dev.throwOnMissingDataFixers` -- Default: false -- Throw's an exception if a DataFixer isn't registered - `Util#debugRunnable` & `Util#debugSupplier`: - Argument: `fabric.dev.enableSupplierAndRunnableDebugging` - Default: false diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java index cf1fa7dc04..a18ecf6bae 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java @@ -21,21 +21,17 @@ public class FabricDev { public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations", true); public static final boolean LOG_CONVENTION_ISSUES = getProperty("logConventionIssues", true); public static final boolean ALWAYS_AGREE_TO_EULA = getProperty("alwaysAgreeToEula", false); - public static final boolean TICK_TEST_MANAGER = getProperty("tickTestManager", false); public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands", true); - public static final boolean REGISTER_TEST_ARGUMENTS = getProperty("registerTestArguments", false); public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging", true); public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging", true); public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes", true); public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging", true); - public static final boolean ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS = getProperty("enableLoadingStructuresFromGameTests", true); - public static final boolean THROW_ON_MISSING_DATA_FIXERS = getProperty("throwOnMissingDataFixers", false); public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging", false); public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing", true); private static boolean getProperty(String name, boolean defaultValue) { try { - return "true".equalsIgnoreCase(System.getProperty(name)); + return "true".equalsIgnoreCase(System.getProperty("fabric.dev" + name)); } catch (Throwable e) { return defaultValue; } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java deleted file mode 100644 index 637f73d6e8..0000000000 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ArgumentTypesMixin.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2024 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.dev; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -import net.minecraft.command.argument.ArgumentTypes; - -import net.fabricmc.fabric.FabricDev; - -@Mixin(ArgumentTypes.class) -public class ArgumentTypesMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.REGISTER_TEST_ARGUMENTS") - @ModifyExpressionValue(method = "register(Lnet/minecraft/registry/Registry;)Lnet/minecraft/command/argument/serialize/ArgumentSerializer;", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.REGISTER_TEST_ARGUMENTS; - } -} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index c6360f95b7..ae3ab6f801 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -28,12 +28,11 @@ @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.LOG_CONVENTION_ISSUES") @ModifyExpressionValue(method = { "(Lnet/minecraft/block/AbstractBlock$Settings;)V", "(Lnet/minecraft/item/Item$Settings;)V" }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.LOG_CONVENTION_ISSUES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index fbf2063d02..d410e7daf5 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -27,9 +27,8 @@ @Mixin(BlockBox.class) public class BlockBoxMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.THROW_ON_INVALID_BLOCK_BOXES") @ModifyExpressionValue(method = "(IIIIII)V", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private static boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.THROW_ON_INVALID_BLOCK_BOXES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index 3ad0ac998e..959bdf713c 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -31,21 +31,18 @@ @Mixin(Bootstrap.class) public class BootstrapMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add OR conditions for FabricDev.LOG_MISSING_TRANSLATIONS and FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING") @ModifyExpressionValue(method = "logMissing", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private static boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.LOG_MISSING_TRANSLATIONS || FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING; } - - @Dynamic("Only execute the forEach if FabricDev.LOG_MISSING_TRANSLATIONS is true") + @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Ljava/util/Set;forEach(Ljava/util/function/Consumer;)V")) - private static boolean fabric$wrapWithConditionTranslationWarnings(Set instance, Consumer consumer) { + private static boolean wrapWithConditionTranslationWarnings(Set instance, Consumer consumer) { return FabricDev.LOG_MISSING_TRANSLATIONS; } - - @Dynamic("Only log command argument exceptions if FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING is true") + @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/command/CommandManager;checkMissing()V")) - private static boolean fabric$wrapWithConditionCommandArgumentWarnings() { + private static boolean wrapWithConditionCommandArgumentWarnings() { return FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index c428ae626f..06f4950f2f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -27,9 +27,8 @@ @Mixin(Chunk.class) public class ChunkMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING") @ModifyExpressionValue(method = "sampleHeightmap", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private static boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index 1e2dd10bdb..97c1f0fbed 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -27,15 +27,13 @@ @Mixin(CommandManager.class) public class CommandManagerMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.REGISTER_DEBUG_COMMANDS") @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private static boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.REGISTER_DEBUG_COMMANDS; } - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_COMMAND_EXCEPTION_LOGGING") @ModifyExpressionValue(method = "execute", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule2(boolean original) { + private static boolean mevIsDevelopmentForDevModule2(boolean original) { return original || FabricDev.ENABLE_COMMAND_EXCEPTION_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java index 8883c8b91c..4c557e9281 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java @@ -27,9 +27,8 @@ @Mixin(EulaReader.class) public class EulaReaderMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ALWAYS_AGREE_TO_EULA") @ModifyExpressionValue(method = {"", "createEulaFile"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.ALWAYS_AGREE_TO_EULA; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java deleted file mode 100644 index f8f488d571..0000000000 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/MinecraftServerMixin.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2024 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.dev; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -import net.minecraft.server.MinecraftServer; - -import net.fabricmc.fabric.FabricDev; - -@Mixin(MinecraftServer.class) -public class MinecraftServerMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.TICK_TEST_MANAGER") - @ModifyExpressionValue(method = "tickWorlds", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.TICK_TEST_MANAGER; - } -} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java deleted file mode 100644 index 2d2063abc7..0000000000 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/StructureTemplateManagerMixin.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2024 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.dev; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -import net.minecraft.structure.StructureTemplateManager; - -import net.fabricmc.fabric.FabricDev; - -@Mixin(StructureTemplateManager.class) -public class StructureTemplateManagerMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS") - @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.ENABLE_LOADING_STRUCTURES_FROM_GAMETESTS; - } -} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 4085deb36f..55b3d7ee59 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -27,24 +27,16 @@ @Mixin(Util.class) public class UtilMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.THROW_ON_MISSING_DATA_FIXERS") - @ModifyExpressionValue(method = "getChoiceTypeInternal", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.THROW_ON_MISSING_DATA_FIXERS; - } - - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING") @ModifyExpressionValue(method = { "debugRunnable(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", "debugSupplier(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;" }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule2(boolean original) { + private static boolean mevIsDevelopmentForDevModule2(boolean original) { return original || FabricDev.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; } - - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ENABLE_EXCEPTION_IDE_PAUSING") + @ModifyExpressionValue(method = {"error", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule3(boolean original) { + private static boolean mevIsDevelopmentForDevModule3(boolean original) { return original || FabricDev.ENABLE_EXCEPTION_IDE_PAUSING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 61617b4846..640418111b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -27,9 +27,8 @@ @Mixin(Weight.class) public class WeightMixin { - @Dynamic("@ModifyExpressionValue's the FIELD GET of SharedConstants.isDevelopment to add a OR condition for FabricDev.ZERO_WEIGHT_WARNING") @ModifyExpressionValue(method = "validate", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean fabric$mevIsDevelopmentForDevModule(boolean original) { + private static boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDev.ZERO_WEIGHT_WARNING; } } diff --git a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json index 36fc3ad60f..70c19afffb 100644 --- a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json +++ b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json @@ -1,19 +1,16 @@ { "required": true, - "package": "net.fabricmc.fabric.mixin", + "package": "net.fabricmc.fabric.mixin.dev", "compatibilityLevel": "JAVA_17", "mixins": [ - "dev.ArgumentTypesMixin", - "dev.BlockAndItemMixin", - "dev.BlockBoxMixin", - "dev.BootstrapMixin", - "dev.ChunkMixin", - "dev.CommandManagerMixin", - "dev.EulaReaderMixin", - "dev.MinecraftServerMixin", - "dev.StructureTemplateManagerMixin", - "dev.UtilMixin", - "dev.WeightMixin" + "BlockAndItemMixin", + "BlockBoxMixin", + "BootstrapMixin", + "ChunkMixin", + "CommandManagerMixin", + "EulaReaderMixin", + "UtilMixin", + "WeightMixin" ], "injectors": { "defaultRequire": 1 From 5c36c737f68005092c8dde4628663eda3cf6a1c0 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 13 Sep 2024 15:39:49 -0400 Subject: [PATCH 06/18] Remove unused import --- .../java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java | 1 - .../main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java | 1 - .../main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java | 1 - .../src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java | 1 - .../java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java | 1 - .../main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java | 1 - .../src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java | 1 - .../src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java | 1 - 8 files changed, 8 deletions(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index ae3ab6f801..c15f80d897 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index d410e7daf5..d6294cd23e 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index 959bdf713c..88740e6e00 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -21,7 +21,6 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index 06f4950f2f..e526d87e66 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index 97c1f0fbed..39a8300cec 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java index 4c557e9281..a186040386 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 55b3d7ee59..92185eabf6 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 640418111b..3f4e1e4eae 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -17,7 +17,6 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Dynamic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; From e5226ed8c868e45f272165a400e423f789f3db49 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 13 Sep 2024 15:42:17 -0400 Subject: [PATCH 07/18] fix typo --- fabric-api-dev/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric-api-dev/README.md b/fabric-api-dev/README.md index 65d728a35f..6b857575ea 100644 --- a/fabric-api-dev/README.md +++ b/fabric-api-dev/README.md @@ -27,7 +27,7 @@ `CommandManager#`: - Argument: `fabric.dev.registerDebugCommands` - Default: true -- Register's Minecraft's debug commands (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, WardenSpawnTrackerCommand, SpawnArmorTrimsCommand, ServerPackCommand) and if on the server DebugConfigCommand +- Registers Minecraft's debug commands (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, WardenSpawnTrackerCommand, SpawnArmorTrimsCommand, ServerPackCommand) and if on the server DebugConfigCommand `CommandManager#execute`: - Argument: `fabric.dev.enableCommandExceptionLogging` From a5bd1d011bc282bc9ec8f9306a23eae04f6af428 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 13 Sep 2024 16:14:06 -0400 Subject: [PATCH 08/18] Address the last few reviews --- fabric-api-dev/README.md | 55 ------- .../java/net/fabricmc/fabric/FabricDev.java | 39 ----- .../fabricmc/fabric/FabricDevProperties.java | 136 ++++++++++++++++++ .../fabric/mixin/dev/BlockAndItemMixin.java | 7 +- .../fabric/mixin/dev/BlockBoxMixin.java | 7 +- .../fabric/mixin/dev/BootstrapMixin.java | 11 +- .../fabricmc/fabric/mixin/dev/ChunkMixin.java | 4 +- .../fabric/mixin/dev/CommandManagerMixin.java | 9 +- .../fabric/mixin/dev/EulaReaderMixin.java | 7 +- .../fabricmc/fabric/mixin/dev/UtilMixin.java | 9 +- .../fabric/mixin/dev/WeightMixin.java | 4 +- gradle.properties | 2 +- 12 files changed, 169 insertions(+), 121 deletions(-) delete mode 100644 fabric-api-dev/README.md delete mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java create mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java diff --git a/fabric-api-dev/README.md b/fabric-api-dev/README.md deleted file mode 100644 index 6b857575ea..0000000000 --- a/fabric-api-dev/README.md +++ /dev/null @@ -1,55 +0,0 @@ -`Weight#validate`: -- Argument: `fabric.dev.zeroWeightWarning` -- Default: true -- Logs an error when a weight is set to 0 - -`Bootstrap#logMissing`: -- Argument `fabric.dev.logMissingTranslations` -- Default: true -- Logs an error when a translation is missing - -`CommandManager#checkMissing`: -- Argument `fabric.dev.enableCommandArgumentLogging` -- Default: true -- Logs an error regarding argument ambiguity and throws an exception if an argument type is not registered - -`Block#` & `Item#`: -- Argument `fabric.dev.logConventionIssues` -- Default: true -- Logs an error if Block classes don't end with Block and if Item classes don't end with Item - -`EulaReader#` & `EulaReader#createEulaFile`: -- Argument: `fabric.dev.alwaysAgreeToEula` -- Default: false -- Note: By enabling this, you declare that you have agreed to the EULA. -- Skips creating the eula.txt file and always agrees to the EULA - -`CommandManager#`: -- Argument: `fabric.dev.registerDebugCommands` -- Default: true -- Registers Minecraft's debug commands (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, WardenSpawnTrackerCommand, SpawnArmorTrimsCommand, ServerPackCommand) and if on the server DebugConfigCommand - -`CommandManager#execute`: -- Argument: `fabric.dev.enableCommandExceptionLogging` -- Default: true -- Logs an error if a command threw an exception - -`BlockBox#` -- Argument: `fabric.dev.throwOnInvalidBlockBoxes` -- Default: true -- Throw's an exception if a bounding box is invalid - -`Chunk#sampleHeightmap`: -- Argument: `fabric.dev.enableUnprimedHeightmapLogging` -- Default: true -- Logs an error if the heightmap is null - -`Util#debugRunnable` & `Util#debugSupplier`: -- Argument: `fabric.dev.enableSupplierAndRunnableDebugging` -- Default: false -- Set's the current thread's name to the activeThreadName if debugRunnable or debugSupplier is called - -`Util#error` & `Util#throwOrPause`: -- Argument: `fabric.dev.enableExceptionIdePausing` -- Default: true -- Call's a method in which you should have a breakpoint to debug errors thrown with Util#error and exceptions thrown with Util#throwOrPause diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java deleted file mode 100644 index a18ecf6bae..0000000000 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDev.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2024 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric; - -public class FabricDev { - public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning", true); - public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations", true); - public static final boolean LOG_CONVENTION_ISSUES = getProperty("logConventionIssues", true); - public static final boolean ALWAYS_AGREE_TO_EULA = getProperty("alwaysAgreeToEula", false); - public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands", true); - public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging", true); - public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging", true); - public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes", true); - public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging", true); - public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging", false); - public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing", true); - - private static boolean getProperty(String name, boolean defaultValue) { - try { - return "true".equalsIgnoreCase(System.getProperty("fabric.dev" + name)); - } catch (Throwable e) { - return defaultValue; - } - } -} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java new file mode 100644 index 0000000000..c9667cf10a --- /dev/null +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024 FabricMC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.fabricmc.fabric; + +import com.mojang.brigadier.ParseResults; + +import net.fabricmc.loader.api.FabricLoader; + +import net.minecraft.Bootstrap; +import net.minecraft.server.command.CommandManager; +import net.minecraft.server.dedicated.EulaReader; +import net.minecraft.util.collection.Weight; +import net.minecraft.world.Heightmap; + +import java.util.function.Supplier; + +@SuppressWarnings("JavadocReference") +public class FabricDevProperties { + /** + * Logs an error when a weight is set to zero
+ * Property: fabric.dev.zeroWeightWarning
+ * Default value: true
+ * {@link Weight#validate(int)} + */ + public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning", true); + + /** + * Logs an error when a translation is missing
+ * Property: fabric.dev.logMissingTranslations
+ * Default value: true
+ * {@link Bootstrap#logMissing()} + */ + public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations", true); + + /** + * Logs an error if Block classes don't end with Block and if Item classes don't end with Item
+ * Property: fabric.dev.logConventionIssues
+ * Default value: true
+ * {@link net.minecraft.block.Block#Block} and {@link net.minecraft.item.Item#Item} + */ + public static final boolean LOG_CONVENTION_ISSUES = getProperty("logConventionIssues", true); + + /** + * Skips creating the eula.txt file and always agrees to the EULA
+ * Note: By enabling this, you declare that you have agreed to the EULA.
+ * Property: fabric.dev.alwaysAgreeToEula
+ * Default value: false
+ * {@link net.minecraft.server.dedicated.EulaReader#EulaReader} and {@link EulaReader#createEulaFile()} + */ + public static final boolean ALWAYS_AGREE_TO_EULA = getProperty("alwaysAgreeToEula", false); + + /** + * Registers Minecraft's debug commands + * (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, + * WardenSpawnTrackerCommand, SpawnArmorTrimsCommand, ServerPackCommand), + * and if on the server DebugConfigCommand
+ * Property: fabric.dev.registerDebugCommands
+ * Default value: true
+ * {@link CommandManager#CommandManager} + */ + public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands", true); + + /** + * Logs an error if a command threw an exception
+ * Property: fabric.dev.enableCommandExceptionLogging
+ * Default value: true
+ * {@link CommandManager#execute(ParseResults, String)} + */ + public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging", true); + + /** + * Logs an error regarding argument ambiguity and throws an exception if an argument type is not registered
+ * Property: fabric.dev.enableCommandArgumentLogging
+ * Default value: true
+ * {@link CommandManager#checkMissing()} + */ + public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging", true); + + /** + * Throw's an exception if a bounding box is invalid
+ * Property: fabric.dev.throwOnInvalidBlockBoxes
+ * Default value: true
+ * {@link net.minecraft.util.math.BlockBox#BlockBox(int, int, int, int, int, int)} + */ + public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes", true); + + /** + * Logs an error if the heightmap is null
+ * Property: fabric.dev.enableUnprimedHeightmapLogging
+ * Default value: true
+ * {@link net.minecraft.world.chunk.Chunk#sampleHeightmap(Heightmap.Type, int, int)} + */ + public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging", true); + + /** + * Set's the current thread's name to the activeThreadName if debugRunnable or debugSupplier is called
+ * Property: fabric.dev.enableSupplierAndRunnableDebugging
+ * Default value: false
+ * {@link net.minecraft.util.Util#debugRunnable(String, Runnable)} and {@link net.minecraft.util.Util#debugSupplier(String, Supplier)} + */ + public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging", false); + + /** + * Invokes a method in which you should have a breakpoint to debug errors + * thrown with Util#error and exceptions thrown with Util#throwOrPause
+ * Property: fabric.dev.enableExceptionIdePausing
+ * Default value: true
+ * {@link net.minecraft.util.Util#error(String)}, {@link net.minecraft.util.Util#error(String, Throwable)} + * and {@link net.minecraft.util.Util#throwOrPause(Throwable)} + */ + public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing", true); + + private static final boolean IS_DEVELOPMENT_ENV = FabricLoader.getInstance().isDevelopmentEnvironment(); + + private static boolean getProperty(String name, boolean defaultValue) { + try { + return "true".equalsIgnoreCase(System.getProperty("fabric.dev" + name)); + } catch (Throwable e) { + return IS_DEVELOPMENT_ENV && defaultValue; + } + } +} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index c15f80d897..e19cdbd9ef 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -17,14 +17,15 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDevProperties; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.fabricmc.fabric.FabricDev; - @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { @ModifyExpressionValue(method = { @@ -32,6 +33,6 @@ public class BlockAndItemMixin { "(Lnet/minecraft/item/Item$Settings;)V" }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.LOG_CONVENTION_ISSUES; + return original || FabricDevProperties.LOG_CONVENTION_ISSUES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index d6294cd23e..9aff41ea67 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -17,17 +17,18 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDevProperties; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.util.math.BlockBox; -import net.fabricmc.fabric.FabricDev; - @Mixin(BlockBox.class) public class BlockBoxMixin { @ModifyExpressionValue(method = "(IIIIII)V", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.THROW_ON_INVALID_BLOCK_BOXES; + return original || FabricDevProperties.THROW_ON_INVALID_BLOCK_BOXES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index 88740e6e00..d3f82cb717 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -21,27 +21,28 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; + +import net.fabricmc.fabric.FabricDevProperties; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.Bootstrap; -import net.fabricmc.fabric.FabricDev; - @Mixin(Bootstrap.class) public class BootstrapMixin { @ModifyExpressionValue(method = "logMissing", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.LOG_MISSING_TRANSLATIONS || FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING; + return original || FabricDevProperties.LOG_MISSING_TRANSLATIONS || FabricDevProperties.ENABLE_COMMAND_ARGUMENT_LOGGING; } @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Ljava/util/Set;forEach(Ljava/util/function/Consumer;)V")) private static boolean wrapWithConditionTranslationWarnings(Set instance, Consumer consumer) { - return FabricDev.LOG_MISSING_TRANSLATIONS; + return FabricDevProperties.LOG_MISSING_TRANSLATIONS; } @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/command/CommandManager;checkMissing()V")) private static boolean wrapWithConditionCommandArgumentWarnings() { - return FabricDev.ENABLE_COMMAND_ARGUMENT_LOGGING; + return FabricDevProperties.ENABLE_COMMAND_ARGUMENT_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index e526d87e66..97c20d4c8e 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -22,12 +22,12 @@ import net.minecraft.world.chunk.Chunk; -import net.fabricmc.fabric.FabricDev; +import net.fabricmc.fabric.FabricDevProperties; @Mixin(Chunk.class) public class ChunkMixin { @ModifyExpressionValue(method = "sampleHeightmap", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING; + return original || FabricDevProperties.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index 39a8300cec..c69b1ba312 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -17,22 +17,23 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDevProperties; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.server.command.CommandManager; -import net.fabricmc.fabric.FabricDev; - @Mixin(CommandManager.class) public class CommandManagerMixin { @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.REGISTER_DEBUG_COMMANDS; + return original || FabricDevProperties.REGISTER_DEBUG_COMMANDS; } @ModifyExpressionValue(method = "execute", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule2(boolean original) { - return original || FabricDev.ENABLE_COMMAND_EXCEPTION_LOGGING; + return original || FabricDevProperties.ENABLE_COMMAND_EXCEPTION_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java index a186040386..6011f4af4e 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java @@ -17,17 +17,18 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDevProperties; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.server.dedicated.EulaReader; -import net.fabricmc.fabric.FabricDev; - @Mixin(EulaReader.class) public class EulaReaderMixin { @ModifyExpressionValue(method = {"", "createEulaFile"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.ALWAYS_AGREE_TO_EULA; + return original || FabricDevProperties.ALWAYS_AGREE_TO_EULA; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 92185eabf6..30cdfcf774 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -17,13 +17,14 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.fabricmc.fabric.FabricDevProperties; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.util.Util; -import net.fabricmc.fabric.FabricDev; - @Mixin(Util.class) public class UtilMixin { @ModifyExpressionValue(method = { @@ -31,11 +32,11 @@ public class UtilMixin { "debugSupplier(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;" }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule2(boolean original) { - return original || FabricDev.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; + return original || FabricDevProperties.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; } @ModifyExpressionValue(method = {"error", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule3(boolean original) { - return original || FabricDev.ENABLE_EXCEPTION_IDE_PAUSING; + return original || FabricDevProperties.ENABLE_EXCEPTION_IDE_PAUSING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 3f4e1e4eae..a99e72030f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -22,12 +22,12 @@ import net.minecraft.util.collection.Weight; -import net.fabricmc.fabric.FabricDev; +import net.fabricmc.fabric.FabricDevProperties; @Mixin(Weight.class) public class WeightMixin { @ModifyExpressionValue(method = "validate", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDev.ZERO_WEIGHT_WARNING; + return original || FabricDevProperties.ZERO_WEIGHT_WARNING; } } diff --git a/gradle.properties b/gradle.properties index a9182c2b3c..d3920c1cc3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ curseforge_minecraft_version=1.21.1 # Do not manually update, use the bumpversions task: fabric-api-base-version=0.4.42 -fabric-api-dev-version=0.0.1 +fabric-api-dev-version=1.0.0 fabric-api-lookup-api-v1-version=1.6.68 fabric-biome-api-v1-version=13.0.29 fabric-block-api-v1-version=1.0.22 From 4a921f5cfab2e12ef53929193d7b84012a685c0f Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 13 Sep 2024 16:16:35 -0400 Subject: [PATCH 09/18] Last fixes --- .../net/fabricmc/fabric/{ => impl}/FabricDevProperties.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java | 4 ++-- .../java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java | 4 ++-- .../net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java | 4 ++-- .../main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/{ => impl}/FabricDevProperties.java (99%) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java similarity index 99% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java index c9667cf10a..e38421b852 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric; +package net.fabricmc.fabric.impl; import com.mojang.brigadier.ParseResults; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index e19cdbd9ef..d826544362 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -18,7 +18,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index 9aff41ea67..8606fb722b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -18,7 +18,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -28,7 +28,7 @@ @Mixin(BlockBox.class) public class BlockBoxMixin { @ModifyExpressionValue(method = "(IIIIII)V", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule(boolean original) { + private boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.THROW_ON_INVALID_BLOCK_BOXES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index d3f82cb717..e5d6f26dec 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -22,7 +22,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index 97c20d4c8e..fbec4a7825 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -22,12 +22,12 @@ import net.minecraft.world.chunk.Chunk; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; @Mixin(Chunk.class) public class ChunkMixin { @ModifyExpressionValue(method = "sampleHeightmap", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule(boolean original) { + private boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index c69b1ba312..2ebb11f178 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -18,7 +18,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java index 6011f4af4e..476084310b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java @@ -18,7 +18,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 30cdfcf774..444676cd20 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -18,7 +18,7 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -35,7 +35,7 @@ private static boolean mevIsDevelopmentForDevModule2(boolean original) { return original || FabricDevProperties.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; } - @ModifyExpressionValue(method = {"error", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) + @ModifyExpressionValue(method = {"error(Ljava/lang/String;)V", "error(Ljava/lang/String;Ljava/lang/Throwable;)V", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule3(boolean original) { return original || FabricDevProperties.ENABLE_EXCEPTION_IDE_PAUSING; } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index a99e72030f..81d908fd99 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.collection.Weight; -import net.fabricmc.fabric.FabricDevProperties; +import net.fabricmc.fabric.impl.FabricDevProperties; @Mixin(Weight.class) public class WeightMixin { From 95fe8c77e80f0263975dcc9a7f0c04007111cf0a Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 13 Sep 2024 16:17:39 -0400 Subject: [PATCH 10/18] run formatter --- .../fabric/impl/FabricDevProperties.java | 26 +++++++++---------- .../fabric/mixin/dev/BlockAndItemMixin.java | 7 +++-- .../fabric/mixin/dev/BlockBoxMixin.java | 7 +++-- .../fabric/mixin/dev/BootstrapMixin.java | 11 ++++---- .../fabricmc/fabric/mixin/dev/ChunkMixin.java | 2 +- .../fabric/mixin/dev/CommandManagerMixin.java | 7 +++-- .../fabric/mixin/dev/EulaReaderMixin.java | 7 +++-- .../fabricmc/fabric/mixin/dev/UtilMixin.java | 9 +++---- .../fabric/mixin/dev/WeightMixin.java | 2 +- 9 files changed, 36 insertions(+), 42 deletions(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java index e38421b852..9bc8b1f87d 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ package net.fabricmc.fabric.impl; -import com.mojang.brigadier.ParseResults; +import java.util.function.Supplier; -import net.fabricmc.loader.api.FabricLoader; +import com.mojang.brigadier.ParseResults; import net.minecraft.Bootstrap; import net.minecraft.server.command.CommandManager; @@ -26,7 +26,7 @@ import net.minecraft.util.collection.Weight; import net.minecraft.world.Heightmap; -import java.util.function.Supplier; +import net.fabricmc.loader.api.FabricLoader; @SuppressWarnings("JavadocReference") public class FabricDevProperties { @@ -37,7 +37,7 @@ public class FabricDevProperties { * {@link Weight#validate(int)} */ public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning", true); - + /** * Logs an error when a translation is missing
* Property: fabric.dev.logMissingTranslations
@@ -45,7 +45,7 @@ public class FabricDevProperties { * {@link Bootstrap#logMissing()} */ public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations", true); - + /** * Logs an error if Block classes don't end with Block and if Item classes don't end with Item
* Property: fabric.dev.logConventionIssues
@@ -53,7 +53,7 @@ public class FabricDevProperties { * {@link net.minecraft.block.Block#Block} and {@link net.minecraft.item.Item#Item} */ public static final boolean LOG_CONVENTION_ISSUES = getProperty("logConventionIssues", true); - + /** * Skips creating the eula.txt file and always agrees to the EULA
* Note: By enabling this, you declare that you have agreed to the EULA.
@@ -62,7 +62,7 @@ public class FabricDevProperties { * {@link net.minecraft.server.dedicated.EulaReader#EulaReader} and {@link EulaReader#createEulaFile()} */ public static final boolean ALWAYS_AGREE_TO_EULA = getProperty("alwaysAgreeToEula", false); - + /** * Registers Minecraft's debug commands * (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, @@ -73,7 +73,7 @@ public class FabricDevProperties { * {@link CommandManager#CommandManager} */ public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands", true); - + /** * Logs an error if a command threw an exception
* Property: fabric.dev.enableCommandExceptionLogging
@@ -89,7 +89,7 @@ public class FabricDevProperties { * {@link CommandManager#checkMissing()} */ public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging", true); - + /** * Throw's an exception if a bounding box is invalid
* Property: fabric.dev.throwOnInvalidBlockBoxes
@@ -97,7 +97,7 @@ public class FabricDevProperties { * {@link net.minecraft.util.math.BlockBox#BlockBox(int, int, int, int, int, int)} */ public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes", true); - + /** * Logs an error if the heightmap is null
* Property: fabric.dev.enableUnprimedHeightmapLogging
@@ -105,7 +105,7 @@ public class FabricDevProperties { * {@link net.minecraft.world.chunk.Chunk#sampleHeightmap(Heightmap.Type, int, int)} */ public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging", true); - + /** * Set's the current thread's name to the activeThreadName if debugRunnable or debugSupplier is called
* Property: fabric.dev.enableSupplierAndRunnableDebugging
@@ -125,7 +125,7 @@ public class FabricDevProperties { public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing", true); private static final boolean IS_DEVELOPMENT_ENV = FabricLoader.getInstance().isDevelopmentEnvironment(); - + private static boolean getProperty(String name, boolean defaultValue) { try { return "true".equalsIgnoreCase(System.getProperty("fabric.dev" + name)); diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index d826544362..317055f87b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,14 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.impl.FabricDevProperties; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.block.Block; import net.minecraft.item.Item; +import net.fabricmc.fabric.impl.FabricDevProperties; + @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { @ModifyExpressionValue(method = { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index 8606fb722b..d7c93e84de 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.impl.FabricDevProperties; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.util.math.BlockBox; +import net.fabricmc.fabric.impl.FabricDevProperties; + @Mixin(BlockBox.class) public class BlockBoxMixin { @ModifyExpressionValue(method = "(IIIIII)V", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index e5d6f26dec..5c2e3308b8 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,26 +21,25 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; - -import net.fabricmc.fabric.impl.FabricDevProperties; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.Bootstrap; +import net.fabricmc.fabric.impl.FabricDevProperties; + @Mixin(Bootstrap.class) public class BootstrapMixin { @ModifyExpressionValue(method = "logMissing", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.LOG_MISSING_TRANSLATIONS || FabricDevProperties.ENABLE_COMMAND_ARGUMENT_LOGGING; } - + @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Ljava/util/Set;forEach(Ljava/util/function/Consumer;)V")) private static boolean wrapWithConditionTranslationWarnings(Set instance, Consumer consumer) { return FabricDevProperties.LOG_MISSING_TRANSLATIONS; } - + @WrapWithCondition(method = "logMissing", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/command/CommandManager;checkMissing()V")) private static boolean wrapWithConditionCommandArgumentWarnings() { return FabricDevProperties.ENABLE_COMMAND_ARGUMENT_LOGGING; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index fbec4a7825..d0020ceefd 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index 2ebb11f178..b6bb61c4a7 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.impl.FabricDevProperties; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.server.command.CommandManager; +import net.fabricmc.fabric.impl.FabricDevProperties; + @Mixin(CommandManager.class) public class CommandManagerMixin { @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java index 476084310b..8838fb9da9 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.impl.FabricDevProperties; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.server.dedicated.EulaReader; +import net.fabricmc.fabric.impl.FabricDevProperties; + @Mixin(EulaReader.class) public class EulaReaderMixin { @ModifyExpressionValue(method = {"", "createEulaFile"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 444676cd20..81c48a9dfb 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,13 @@ package net.fabricmc.fabric.mixin.dev; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; - -import net.fabricmc.fabric.impl.FabricDevProperties; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import net.minecraft.util.Util; +import net.fabricmc.fabric.impl.FabricDevProperties; + @Mixin(Util.class) public class UtilMixin { @ModifyExpressionValue(method = { @@ -34,7 +33,7 @@ public class UtilMixin { private static boolean mevIsDevelopmentForDevModule2(boolean original) { return original || FabricDevProperties.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; } - + @ModifyExpressionValue(method = {"error(Ljava/lang/String;)V", "error(Ljava/lang/String;Ljava/lang/Throwable;)V", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) private static boolean mevIsDevelopmentForDevModule3(boolean original) { return original || FabricDevProperties.ENABLE_EXCEPTION_IDE_PAUSING; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 81d908fd99..499e479c52 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 FabricMC + * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From ae86e8227593df98db9ba5f10219806f30f679c5 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sat, 14 Sep 2024 08:54:35 -0400 Subject: [PATCH 11/18] update getProperty --- .../java/net/fabricmc/fabric/impl/FabricDevProperties.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java index 9bc8b1f87d..402b35ec01 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java @@ -127,10 +127,9 @@ public class FabricDevProperties { private static final boolean IS_DEVELOPMENT_ENV = FabricLoader.getInstance().isDevelopmentEnvironment(); private static boolean getProperty(String name, boolean defaultValue) { - try { - return "true".equalsIgnoreCase(System.getProperty("fabric.dev" + name)); - } catch (Throwable e) { + String propertyValue = System.getProperty("fabric.dev" + name); + if (propertyValue.isEmpty()) return IS_DEVELOPMENT_ENV && defaultValue; - } + return "true".equalsIgnoreCase(propertyValue); } } From 1594f912ffa3b7f7e52482f1e80f9bf578d05450 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sat, 14 Sep 2024 09:01:34 -0400 Subject: [PATCH 12/18] fix npe --- .../main/java/net/fabricmc/fabric/impl/FabricDevProperties.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java index 402b35ec01..9e71e19d60 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java @@ -128,7 +128,7 @@ public class FabricDevProperties { private static boolean getProperty(String name, boolean defaultValue) { String propertyValue = System.getProperty("fabric.dev" + name); - if (propertyValue.isEmpty()) + if (propertyValue == null || propertyValue.isEmpty()) return IS_DEVELOPMENT_ENV && defaultValue; return "true".equalsIgnoreCase(propertyValue); } From 875254102075a2de31f7616250d93a77321b3edb Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 24 Sep 2024 11:03:05 -0400 Subject: [PATCH 13/18] Address reviews --- .../{impl => api}/FabricDevProperties.java | 49 +++++++------------ .../fabric/mixin/dev/BlockAndItemMixin.java | 6 +-- .../fabric/mixin/dev/BlockBoxMixin.java | 4 +- .../fabric/mixin/dev/BootstrapMixin.java | 4 +- .../fabricmc/fabric/mixin/dev/ChunkMixin.java | 4 +- .../fabric/mixin/dev/CommandManagerMixin.java | 6 +-- .../fabric/mixin/dev/EulaReaderMixin.java | 33 ------------- .../fabricmc/fabric/mixin/dev/UtilMixin.java | 6 +-- .../fabric/mixin/dev/WeightMixin.java | 4 +- .../main/resources/fabric-api-dev.mixins.json | 3 +- .../src/main/resources/fabric.mod.json | 2 +- 11 files changed, 37 insertions(+), 84 deletions(-) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/{impl => api}/FabricDevProperties.java (72%) delete mode 100644 fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java similarity index 72% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java index 9e71e19d60..437043f076 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/impl/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.impl; +package net.fabricmc.fabric.api; import java.util.function.Supplier; @@ -22,12 +22,13 @@ import net.minecraft.Bootstrap; import net.minecraft.server.command.CommandManager; -import net.minecraft.server.dedicated.EulaReader; import net.minecraft.util.collection.Weight; import net.minecraft.world.Heightmap; -import net.fabricmc.loader.api.FabricLoader; +import org.jetbrains.annotations.ApiStatus; +/** Mods should not directly use these fields; they only exist here as a reference of what Dev Properties exist */ +@ApiStatus.Internal @SuppressWarnings("JavadocReference") public class FabricDevProperties { /** @@ -36,7 +37,7 @@ public class FabricDevProperties { * Default value: true
* {@link Weight#validate(int)} */ - public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning", true); + public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning"); /** * Logs an error when a translation is missing
@@ -44,25 +45,16 @@ public class FabricDevProperties { * Default value: true
* {@link Bootstrap#logMissing()} */ - public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations", true); + public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations"); /** - * Logs an error if Block classes don't end with Block and if Item classes don't end with Item
+ * Logs an error if Block classes don't end with "Block" and if Item classes don't end with "Item"
* Property: fabric.dev.logConventionIssues
* Default value: true
* {@link net.minecraft.block.Block#Block} and {@link net.minecraft.item.Item#Item} */ - public static final boolean LOG_CONVENTION_ISSUES = getProperty("logConventionIssues", true); - - /** - * Skips creating the eula.txt file and always agrees to the EULA
- * Note: By enabling this, you declare that you have agreed to the EULA.
- * Property: fabric.dev.alwaysAgreeToEula
- * Default value: false
- * {@link net.minecraft.server.dedicated.EulaReader#EulaReader} and {@link EulaReader#createEulaFile()} - */ - public static final boolean ALWAYS_AGREE_TO_EULA = getProperty("alwaysAgreeToEula", false); - + public static final boolean LOG_BLOCK_AND_ITEM_CONVENTION_ISSUES = getProperty("logBlockAndItemConventionIssues"); + /** * Registers Minecraft's debug commands * (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, @@ -72,7 +64,7 @@ public class FabricDevProperties { * Default value: true
* {@link CommandManager#CommandManager} */ - public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands", true); + public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands"); /** * Logs an error if a command threw an exception
@@ -80,7 +72,7 @@ public class FabricDevProperties { * Default value: true
* {@link CommandManager#execute(ParseResults, String)} */ - public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging", true); + public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging"); /** * Logs an error regarding argument ambiguity and throws an exception if an argument type is not registered
@@ -88,7 +80,7 @@ public class FabricDevProperties { * Default value: true
* {@link CommandManager#checkMissing()} */ - public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging", true); + public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging"); /** * Throw's an exception if a bounding box is invalid
@@ -96,7 +88,7 @@ public class FabricDevProperties { * Default value: true
* {@link net.minecraft.util.math.BlockBox#BlockBox(int, int, int, int, int, int)} */ - public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes", true); + public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes"); /** * Logs an error if the heightmap is null
@@ -104,7 +96,7 @@ public class FabricDevProperties { * Default value: true
* {@link net.minecraft.world.chunk.Chunk#sampleHeightmap(Heightmap.Type, int, int)} */ - public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging", true); + public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging"); /** * Set's the current thread's name to the activeThreadName if debugRunnable or debugSupplier is called
@@ -112,7 +104,7 @@ public class FabricDevProperties { * Default value: false
* {@link net.minecraft.util.Util#debugRunnable(String, Runnable)} and {@link net.minecraft.util.Util#debugSupplier(String, Supplier)} */ - public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging", false); + public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging"); /** * Invokes a method in which you should have a breakpoint to debug errors @@ -122,14 +114,9 @@ public class FabricDevProperties { * {@link net.minecraft.util.Util#error(String)}, {@link net.minecraft.util.Util#error(String, Throwable)} * and {@link net.minecraft.util.Util#throwOrPause(Throwable)} */ - public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing", true); - - private static final boolean IS_DEVELOPMENT_ENV = FabricLoader.getInstance().isDevelopmentEnvironment(); + public static final boolean ENABLE_EXCEPTION_IDE_PAUSING = getProperty("enableExceptionIdePausing"); - private static boolean getProperty(String name, boolean defaultValue) { - String propertyValue = System.getProperty("fabric.dev" + name); - if (propertyValue == null || propertyValue.isEmpty()) - return IS_DEVELOPMENT_ENV && defaultValue; - return "true".equalsIgnoreCase(propertyValue); + private static boolean getProperty(String name) { + return Boolean.getBoolean("fabric.dev." + name); } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index 317055f87b..cc949b843f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -23,7 +23,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { @@ -31,7 +31,7 @@ public class BlockAndItemMixin { "(Lnet/minecraft/block/AbstractBlock$Settings;)V", "(Lnet/minecraft/item/Item$Settings;)V" }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDevProperties.LOG_CONVENTION_ISSUES; + private boolean isDevelopmentForDevModule(boolean original) { + return original || FabricDevProperties.LOG_BLOCK_AND_ITEM_CONVENTION_ISSUES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index d7c93e84de..1363075e1b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -22,12 +22,12 @@ import net.minecraft.util.math.BlockBox; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin(BlockBox.class) public class BlockBoxMixin { @ModifyExpressionValue(method = "(IIIIII)V", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private boolean mevIsDevelopmentForDevModule(boolean original) { + private boolean isDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.THROW_ON_INVALID_BLOCK_BOXES; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index 5c2e3308b8..229fe1dfa5 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -26,12 +26,12 @@ import net.minecraft.Bootstrap; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin(Bootstrap.class) public class BootstrapMixin { @ModifyExpressionValue(method = "logMissing", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule(boolean original) { + private static boolean isDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.LOG_MISSING_TRANSLATIONS || FabricDevProperties.ENABLE_COMMAND_ARGUMENT_LOGGING; } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index d0020ceefd..be5b8ddf29 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -22,12 +22,12 @@ import net.minecraft.world.chunk.Chunk; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin(Chunk.class) public class ChunkMixin { @ModifyExpressionValue(method = "sampleHeightmap", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private boolean mevIsDevelopmentForDevModule(boolean original) { + private boolean isDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.ENABLE_UNPRIMED_HEIGHTMAP_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index b6bb61c4a7..a7b61d75f5 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -22,17 +22,17 @@ import net.minecraft.server.command.CommandManager; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin(CommandManager.class) public class CommandManagerMixin { @ModifyExpressionValue(method = "", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule(boolean original) { + private static boolean isDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.REGISTER_DEBUG_COMMANDS; } @ModifyExpressionValue(method = "execute", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule2(boolean original) { + private static boolean isDevelopmentForDevModule2(boolean original) { return original || FabricDevProperties.ENABLE_COMMAND_EXCEPTION_LOGGING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java deleted file mode 100644 index 8838fb9da9..0000000000 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/EulaReaderMixin.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018, 2019 FabricMC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.fabricmc.fabric.mixin.dev; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -import net.minecraft.server.dedicated.EulaReader; - -import net.fabricmc.fabric.impl.FabricDevProperties; - -@Mixin(EulaReader.class) -public class EulaReaderMixin { - @ModifyExpressionValue(method = {"", "createEulaFile"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private boolean mevIsDevelopmentForDevModule(boolean original) { - return original || FabricDevProperties.ALWAYS_AGREE_TO_EULA; - } -} diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 81c48a9dfb..5cf4b0f427 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.Util; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin(Util.class) public class UtilMixin { @@ -30,12 +30,12 @@ public class UtilMixin { "debugRunnable(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;", "debugSupplier(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;" }, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule2(boolean original) { + private static boolean isDevelopmentForDevModule2(boolean original) { return original || FabricDevProperties.ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING; } @ModifyExpressionValue(method = {"error(Ljava/lang/String;)V", "error(Ljava/lang/String;Ljava/lang/Throwable;)V", "throwOrPause"}, at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule3(boolean original) { + private static boolean isDevelopmentForDevModule3(boolean original) { return original || FabricDevProperties.ENABLE_EXCEPTION_IDE_PAUSING; } } diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 499e479c52..6dc89b35c4 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -22,12 +22,12 @@ import net.minecraft.util.collection.Weight; -import net.fabricmc.fabric.impl.FabricDevProperties; +import net.fabricmc.fabric.api.FabricDevProperties; @Mixin(Weight.class) public class WeightMixin { @ModifyExpressionValue(method = "validate", at = @At(value = "FIELD", target = "Lnet/minecraft/SharedConstants;isDevelopment:Z")) - private static boolean mevIsDevelopmentForDevModule(boolean original) { + private static boolean isDevelopmentForDevModule(boolean original) { return original || FabricDevProperties.ZERO_WEIGHT_WARNING; } } diff --git a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json index 70c19afffb..5414533e11 100644 --- a/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json +++ b/fabric-api-dev/src/main/resources/fabric-api-dev.mixins.json @@ -1,14 +1,13 @@ { "required": true, "package": "net.fabricmc.fabric.mixin.dev", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ "BlockAndItemMixin", "BlockBoxMixin", "BootstrapMixin", "ChunkMixin", "CommandManagerMixin", - "EulaReaderMixin", "UtilMixin", "WeightMixin" ], diff --git a/fabric-api-dev/src/main/resources/fabric.mod.json b/fabric-api-dev/src/main/resources/fabric.mod.json index 081780f7d2..7c287d5f91 100644 --- a/fabric-api-dev/src/main/resources/fabric.mod.json +++ b/fabric-api-dev/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "fabric-api-dev", - "name": "Fabric API Dev Utilities", + "name": "Fabric API Dev Tools", "version": "${version}", "environment": "*", "license": "Apache-2.0", From 7347b525f708c01d9800a71a5a82cc2ff6e389bc Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 24 Sep 2024 11:14:33 -0400 Subject: [PATCH 14/18] run spotless --- .../java/net/fabricmc/fabric/api/FabricDevProperties.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java index 437043f076..b86c24029b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java @@ -19,14 +19,13 @@ import java.util.function.Supplier; import com.mojang.brigadier.ParseResults; +import org.jetbrains.annotations.ApiStatus; import net.minecraft.Bootstrap; import net.minecraft.server.command.CommandManager; import net.minecraft.util.collection.Weight; import net.minecraft.world.Heightmap; -import org.jetbrains.annotations.ApiStatus; - /** Mods should not directly use these fields; they only exist here as a reference of what Dev Properties exist */ @ApiStatus.Internal @SuppressWarnings("JavadocReference") @@ -54,7 +53,7 @@ public class FabricDevProperties { * {@link net.minecraft.block.Block#Block} and {@link net.minecraft.item.Item#Item} */ public static final boolean LOG_BLOCK_AND_ITEM_CONVENTION_ISSUES = getProperty("logBlockAndItemConventionIssues"); - + /** * Registers Minecraft's debug commands * (TestCommand, RaidCommand, DebugPathCommand, DebugMobSpawningCommand, From 3f59370e3ae67c127ce620cd42f3380897be9157 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 24 Sep 2024 21:45:27 -0400 Subject: [PATCH 15/18] make spotless happy --- .../fabricmc/fabric/api/{ => common}/FabricDevProperties.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java | 2 +- .../src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java | 2 +- .../src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/api/{ => common}/FabricDevProperties.java (99%) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/common/FabricDevProperties.java similarity index 99% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/api/common/FabricDevProperties.java index b86c24029b..668ee93d98 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/common/FabricDevProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.api; +package net.fabricmc.fabric.api.common; import java.util.function.Supplier; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index cc949b843f..5893bc942c 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -23,7 +23,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index 1363075e1b..204a2f691c 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockBox; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin(BlockBox.class) public class BlockBoxMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index 229fe1dfa5..b7590433e5 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -26,7 +26,7 @@ import net.minecraft.Bootstrap; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin(Bootstrap.class) public class BootstrapMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index be5b8ddf29..99d1f53e5f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -22,7 +22,7 @@ import net.minecraft.world.chunk.Chunk; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin(Chunk.class) public class ChunkMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index a7b61d75f5..ef54d26811 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -22,7 +22,7 @@ import net.minecraft.server.command.CommandManager; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin(CommandManager.class) public class CommandManagerMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index 5cf4b0f427..d3d180aa23 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.Util; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin(Util.class) public class UtilMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 6dc89b35c4..39f3fe1aff 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.collection.Weight; -import net.fabricmc.fabric.api.FabricDevProperties; +import net.fabricmc.fabric.api.common.FabricDevProperties; @Mixin(Weight.class) public class WeightMixin { From effa8c3346906a6c63d022aa98199f32672c4238 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 25 Sep 2024 10:07:52 -0400 Subject: [PATCH 16/18] fix name --- .../fabric/api/{common => dev}/FabricDevProperties.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java | 2 +- .../src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java | 2 +- .../src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/api/{common => dev}/FabricDevProperties.java (99%) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/common/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/FabricDevProperties.java similarity index 99% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/api/common/FabricDevProperties.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/FabricDevProperties.java index 668ee93d98..a6b4de81b4 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/common/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/FabricDevProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.api.common; +package net.fabricmc.fabric.api.dev; import java.util.function.Supplier; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index 5893bc942c..99437a7743 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -23,7 +23,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index 204a2f691c..e7ff2b0b4a 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockBox; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin(BlockBox.class) public class BlockBoxMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index b7590433e5..f778686a32 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -26,7 +26,7 @@ import net.minecraft.Bootstrap; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin(Bootstrap.class) public class BootstrapMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index 99d1f53e5f..ec62b91f15 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -22,7 +22,7 @@ import net.minecraft.world.chunk.Chunk; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin(Chunk.class) public class ChunkMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index ef54d26811..efc3e391b6 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -22,7 +22,7 @@ import net.minecraft.server.command.CommandManager; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin(CommandManager.class) public class CommandManagerMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index d3d180aa23..cf2a4ae5a7 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.Util; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin(Util.class) public class UtilMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index 39f3fe1aff..daa4e4a36c 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.collection.Weight; -import net.fabricmc.fabric.api.common.FabricDevProperties; +import net.fabricmc.fabric.api.dev.FabricDevProperties; @Mixin(Weight.class) public class WeightMixin { From 7a9c6844b36ab8ec2b4f87a018589278122352a1 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Thu, 26 Sep 2024 10:25:23 -0400 Subject: [PATCH 17/18] fix package name --- .../fabricmc/fabric/api/dev/{ => v1}/FabricDevProperties.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java | 2 +- .../src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java | 2 +- .../java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java | 2 +- .../src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java | 2 +- .../main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/{ => v1}/FabricDevProperties.java (99%) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java similarity index 99% rename from fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/FabricDevProperties.java rename to fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java index a6b4de81b4..4d22dd554b 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package net.fabricmc.fabric.api.dev; +package net.fabricmc.fabric.api.dev.v1; import java.util.function.Supplier; diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java index 99437a7743..1134aac056 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockAndItemMixin.java @@ -23,7 +23,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin({Block.class, Item.class}) public class BlockAndItemMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java index e7ff2b0b4a..2b7e1ce34f 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BlockBoxMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockBox; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin(BlockBox.class) public class BlockBoxMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java index f778686a32..a7fb07de7a 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/BootstrapMixin.java @@ -26,7 +26,7 @@ import net.minecraft.Bootstrap; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin(Bootstrap.class) public class BootstrapMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java index ec62b91f15..aaecf247e9 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/ChunkMixin.java @@ -22,7 +22,7 @@ import net.minecraft.world.chunk.Chunk; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin(Chunk.class) public class ChunkMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java index efc3e391b6..f803e9278c 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/CommandManagerMixin.java @@ -22,7 +22,7 @@ import net.minecraft.server.command.CommandManager; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin(CommandManager.class) public class CommandManagerMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java index cf2a4ae5a7..cc8699b0c2 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/UtilMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.Util; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin(Util.class) public class UtilMixin { diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java index daa4e4a36c..83e8266ce0 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/mixin/dev/WeightMixin.java @@ -22,7 +22,7 @@ import net.minecraft.util.collection.Weight; -import net.fabricmc.fabric.api.dev.FabricDevProperties; +import net.fabricmc.fabric.api.dev.v1.FabricDevProperties; @Mixin(Weight.class) public class WeightMixin { From 723714a1d1668d1fc8feeea45ea83e7638a17e5c Mon Sep 17 00:00:00 2001 From: IThundxr Date: Thu, 14 Nov 2024 21:14:50 -0500 Subject: [PATCH 18/18] Update javadocs --- .../fabric/api/dev/v1/FabricDevProperties.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java index 4d22dd554b..70cba0c585 100644 --- a/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java +++ b/fabric-api-dev/src/main/java/net/fabricmc/fabric/api/dev/v1/FabricDevProperties.java @@ -33,7 +33,6 @@ public class FabricDevProperties { /** * Logs an error when a weight is set to zero
* Property: fabric.dev.zeroWeightWarning
- * Default value: true
* {@link Weight#validate(int)} */ public static final boolean ZERO_WEIGHT_WARNING = getProperty("zeroWeightWarning"); @@ -41,7 +40,6 @@ public class FabricDevProperties { /** * Logs an error when a translation is missing
* Property: fabric.dev.logMissingTranslations
- * Default value: true
* {@link Bootstrap#logMissing()} */ public static final boolean LOG_MISSING_TRANSLATIONS = getProperty("logMissingTranslations"); @@ -49,7 +47,6 @@ public class FabricDevProperties { /** * Logs an error if Block classes don't end with "Block" and if Item classes don't end with "Item"
* Property: fabric.dev.logConventionIssues
- * Default value: true
* {@link net.minecraft.block.Block#Block} and {@link net.minecraft.item.Item#Item} */ public static final boolean LOG_BLOCK_AND_ITEM_CONVENTION_ISSUES = getProperty("logBlockAndItemConventionIssues"); @@ -60,7 +57,6 @@ public class FabricDevProperties { * WardenSpawnTrackerCommand, SpawnArmorTrimsCommand, ServerPackCommand), * and if on the server DebugConfigCommand
* Property: fabric.dev.registerDebugCommands
- * Default value: true
* {@link CommandManager#CommandManager} */ public static final boolean REGISTER_DEBUG_COMMANDS = getProperty("registerDebugCommands"); @@ -68,7 +64,6 @@ public class FabricDevProperties { /** * Logs an error if a command threw an exception
* Property: fabric.dev.enableCommandExceptionLogging
- * Default value: true
* {@link CommandManager#execute(ParseResults, String)} */ public static final boolean ENABLE_COMMAND_EXCEPTION_LOGGING = getProperty("enableCommandExceptionLogging"); @@ -76,7 +71,6 @@ public class FabricDevProperties { /** * Logs an error regarding argument ambiguity and throws an exception if an argument type is not registered
* Property: fabric.dev.enableCommandArgumentLogging
- * Default value: true
* {@link CommandManager#checkMissing()} */ public static final boolean ENABLE_COMMAND_ARGUMENT_LOGGING = getProperty("enableCommandArgumentLogging"); @@ -84,7 +78,6 @@ public class FabricDevProperties { /** * Throw's an exception if a bounding box is invalid
* Property: fabric.dev.throwOnInvalidBlockBoxes
- * Default value: true
* {@link net.minecraft.util.math.BlockBox#BlockBox(int, int, int, int, int, int)} */ public static final boolean THROW_ON_INVALID_BLOCK_BOXES = getProperty("throwOnInvalidBlockBoxes"); @@ -92,7 +85,6 @@ public class FabricDevProperties { /** * Logs an error if the heightmap is null
* Property: fabric.dev.enableUnprimedHeightmapLogging
- * Default value: true
* {@link net.minecraft.world.chunk.Chunk#sampleHeightmap(Heightmap.Type, int, int)} */ public static final boolean ENABLE_UNPRIMED_HEIGHTMAP_LOGGING = getProperty("enableUnprimedHeightmapLogging"); @@ -100,7 +92,6 @@ public class FabricDevProperties { /** * Set's the current thread's name to the activeThreadName if debugRunnable or debugSupplier is called
* Property: fabric.dev.enableSupplierAndRunnableDebugging
- * Default value: false
* {@link net.minecraft.util.Util#debugRunnable(String, Runnable)} and {@link net.minecraft.util.Util#debugSupplier(String, Supplier)} */ public static final boolean ENABLE_SUPPLIER_AND_RUNNABLE_DEBUGGING = getProperty("enableSupplierAndRunnableDebugging"); @@ -109,7 +100,6 @@ public class FabricDevProperties { * Invokes a method in which you should have a breakpoint to debug errors * thrown with Util#error and exceptions thrown with Util#throwOrPause
* Property: fabric.dev.enableExceptionIdePausing
- * Default value: true
* {@link net.minecraft.util.Util#error(String)}, {@link net.minecraft.util.Util#error(String, Throwable)} * and {@link net.minecraft.util.Util#throwOrPause(Throwable)} */