Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Dec 30, 2024
1 parent 391b353 commit a9cb358
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Map.Entry<Path, HashCode>> sortPaths(ImmutableSet<Map.Entry<Path, HashCode>> original) {
return original.stream()
.sorted(Map.Entry.comparingByKey(Comparator.comparing(k -> normalizePath(k.toString()))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> providerNames, GameVersion gameVersion, Operation<DataCache> original) {
if ((Object)(this) instanceof FabricDataGeneratorImpl fabricDataGenerator) {
if ((Object) (this) instanceof FabricDataGeneratorImpl fabricDataGenerator) {
return fabricDataGenerator.getDataCache();
}

Expand All @@ -43,7 +43,7 @@ private DataCache newDataCache(Path root, Collection<String> providerNames, Game

@WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/DataCache;write()V"))
private void dataCacheWrite(DataCache instance, Operation<Void> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> addProvider(DataGenerator instance, Operation<Set<String>> original) {
if ((Object)(instance) instanceof FabricDataGeneratorImpl fabricDataGenerator) {
if ((Object) (instance) instanceof FabricDataGeneratorImpl fabricDataGenerator) {
return fabricDataGenerator.getProviderNames();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit a9cb358

Please sign in to comment.