From a9cb358e4e7ee15534e17a542aea5a8c6e6295d6 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 30 Dec 2024 16:37:57 +0000 Subject: [PATCH] Fix build --- .../fabric/impl/datagen/FabricDataGenHelper.java | 7 ++----- .../impl/datagen/FabricDataGeneratorImpl.java | 11 +++++------ .../mixin/datagen/DataCacheCachedDataMixin.java | 6 ++++-- .../fabric/mixin/datagen/DataGeneratorMixin.java | 4 ++-- .../mixin/datagen/DataGeneratorPackMixin.java | 2 +- .../DataGeneratorEmptyTestEntrypoint.java | 16 ++++++++++++++++ 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGenHelper.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGenHelper.java index a2a7f06f3b..5cd7fc19e3 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGenHelper.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGenHelper.java @@ -35,15 +35,13 @@ import com.mojang.serialization.JsonOps; import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; - -import net.minecraft.SharedConstants; -import net.minecraft.data.DataCache; - import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import net.minecraft.SharedConstants; +import net.minecraft.data.DataCache; import net.minecraft.data.DataProvider; import net.minecraft.registry.BuiltinRegistries; import net.minecraft.registry.DynamicRegistryManager; @@ -56,7 +54,6 @@ import net.minecraft.util.Util; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; -import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; import net.fabricmc.fabric.api.event.registry.DynamicRegistries; import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition; import net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditions; diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGeneratorImpl.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGeneratorImpl.java index c1be422c96..f2a80d95d2 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGeneratorImpl.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricDataGeneratorImpl.java @@ -16,16 +16,15 @@ package net.fabricmc.fabric.impl.datagen; -import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; - -import net.fabricmc.loader.api.ModContainer; +import java.nio.file.Path; +import java.util.Set; +import java.util.concurrent.CompletableFuture; import net.minecraft.data.DataCache; import net.minecraft.registry.RegistryWrapper; -import java.nio.file.Path; -import java.util.Set; -import java.util.concurrent.CompletableFuture; +import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +import net.fabricmc.loader.api.ModContainer; public class FabricDataGeneratorImpl extends FabricDataGenerator { private final DataCache dataCache; diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataCacheCachedDataMixin.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataCacheCachedDataMixin.java index ed2bc7b0d8..c399e115aa 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataCacheCachedDataMixin.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataCacheCachedDataMixin.java @@ -27,9 +27,11 @@ import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -@Mixin(targets = "net.minecraft.data.DataCache$CachedData") +import net.minecraft.data.DataCache; + +@Mixin(DataCache.CachedData.class) public abstract class DataCacheCachedDataMixin { - @ModifyExpressionValue(method = "write", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableMap;entrySet()Lcom/google/common/collect/ImmutableSet;")) + @ModifyExpressionValue(method = "write", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableMap;entrySet()Lcom/google/common/collect/ImmutableSet;", remap = false)) private ImmutableSet> sortPaths(ImmutableSet> original) { return original.stream() .sorted(Map.Entry.comparingByKey(Comparator.comparing(k -> normalizePath(k.toString())))) diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorMixin.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorMixin.java index 32d003a84d..29f1df4640 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorMixin.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorMixin.java @@ -34,7 +34,7 @@ public class DataGeneratorMixin { @WrapOperation(method = "run", at = @At(value = "NEW", target = "(Ljava/nio/file/Path;Ljava/util/Collection;Lnet/minecraft/GameVersion;)Lnet/minecraft/data/DataCache;")) private DataCache newDataCache(Path root, Collection providerNames, GameVersion gameVersion, Operation original) { - if ((Object)(this) instanceof FabricDataGeneratorImpl fabricDataGenerator) { + if ((Object) (this) instanceof FabricDataGeneratorImpl fabricDataGenerator) { return fabricDataGenerator.getDataCache(); } @@ -43,7 +43,7 @@ private DataCache newDataCache(Path root, Collection providerNames, Game @WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/DataCache;write()V")) private void dataCacheWrite(DataCache instance, Operation original) { - if ((Object)(this) instanceof FabricDataGeneratorImpl) { + if ((Object) (this) instanceof FabricDataGeneratorImpl) { // Skip this for now, we will run it for all data generators in FabricDataGenHelper return; } diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorPackMixin.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorPackMixin.java index e321719cea..b830980088 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorPackMixin.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/DataGeneratorPackMixin.java @@ -31,7 +31,7 @@ public class DataGeneratorPackMixin { @WrapOperation(method = "addProvider", at = @At(value = "FIELD", target = "Lnet/minecraft/data/DataGenerator;providerNames:Ljava/util/Set;")) private Set addProvider(DataGenerator instance, Operation> original) { - if ((Object)(instance) instanceof FabricDataGeneratorImpl fabricDataGenerator) { + if ((Object) (instance) instanceof FabricDataGeneratorImpl fabricDataGenerator) { return fabricDataGenerator.getProviderNames(); } diff --git a/fabric-data-generation-api-v1/src/testmod/java/net/fabricmc/fabric/test/datagen/DataGeneratorEmptyTestEntrypoint.java b/fabric-data-generation-api-v1/src/testmod/java/net/fabricmc/fabric/test/datagen/DataGeneratorEmptyTestEntrypoint.java index b8d8849c22..0dee950344 100644 --- a/fabric-data-generation-api-v1/src/testmod/java/net/fabricmc/fabric/test/datagen/DataGeneratorEmptyTestEntrypoint.java +++ b/fabric-data-generation-api-v1/src/testmod/java/net/fabricmc/fabric/test/datagen/DataGeneratorEmptyTestEntrypoint.java @@ -1,3 +1,19 @@ +/* + * 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.test.datagen; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;