diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricTagProvider.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricTagProvider.java index 2e637b168..cead009af 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricTagProvider.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricTagProvider.java @@ -254,7 +254,7 @@ private FabricTagBuilder(ProvidedTagBuilder parent) { * @return the {@link FabricTagBuilder} instance */ public FabricTagBuilder setReplace(boolean replace) { - ((net.fabricmc.fabric.impl.datagen.FabricTagBuilder) builder).fabric_setReplace(replace); + replace(replace); return this; } diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricTagBuilder.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricTagBuilder.java deleted file mode 100644 index 47c7f1600..000000000 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/impl/datagen/FabricTagBuilder.java +++ /dev/null @@ -1,23 +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.impl.datagen; - -public interface FabricTagBuilder { - void fabric_setReplace(boolean replace); - - boolean fabric_isReplaced(); -} diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagBuilderMixin.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagBuilderMixin.java deleted file mode 100644 index f9459a478..000000000 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagBuilderMixin.java +++ /dev/null @@ -1,43 +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.datagen; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; - -import net.minecraft.registry.tag.TagBuilder; - -import net.fabricmc.fabric.impl.datagen.FabricTagBuilder; - -/** - * Extends Tag.Builder to support setting the replace field. - */ -@Mixin(TagBuilder.class) -public class TagBuilderMixin implements FabricTagBuilder { - @Unique - private boolean replace = false; - - @Override - public void fabric_setReplace(boolean replace) { - this.replace = replace; - } - - @Override - public boolean fabric_isReplaced() { - return replace; - } -} diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagProviderMixin.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagProviderMixin.java index b9ad16092..6057dfdf1 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagProviderMixin.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/mixin/datagen/TagProviderMixin.java @@ -16,39 +16,17 @@ package net.fabricmc.fabric.mixin.datagen; -import java.nio.file.Path; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.function.Predicate; - -import com.google.gson.JsonElement; import net.minecraftforge.common.data.ExistingFileHelper; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import net.minecraft.data.DataWriter; import net.minecraft.data.server.tag.TagProvider; -import net.minecraft.registry.tag.TagBuilder; -import net.minecraft.registry.tag.TagEntry; import net.minecraft.util.Identifier; -import net.fabricmc.fabric.impl.datagen.FabricTagBuilder; - @Mixin(TagProvider.class) public class TagProviderMixin { - @Inject(method = { "m_254781_", "lambda$run$6" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/data/DataProvider;writeToPath(Lnet/minecraft/data/DataWriter;Lcom/google/gson/JsonElement;Ljava/nio/file/Path;)Ljava/util/concurrent/CompletableFuture;"), locals = LocalCapture.CAPTURE_FAILHARD, require = 1) - public void addReplaced(Predicate predicate, Predicate predicate2, DataWriter dataWriter, Map.Entry entry, CallbackInfoReturnable> cir, Identifier identifier, TagBuilder builder, List list, List list2, JsonElement jsonElement, Path path) { - if (builder instanceof FabricTagBuilder fabricTagBuilder) { - jsonElement.getAsJsonObject().addProperty("replace", fabricTagBuilder.fabric_isReplaced()); - } - } - @Redirect(method = "lambda$getOrCreateRawBuilder$9", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/common/data/ExistingFileHelper;trackGenerated(Lnet/minecraft/util/Identifier;Lnet/minecraftforge/common/data/ExistingFileHelper$IResourceType;)V")) public void fixExistingFileHelperNPE(@Nullable ExistingFileHelper existingFileHelper, Identifier identifier, ExistingFileHelper.IResourceType resourceType) { if (existingFileHelper != null) { diff --git a/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.mixins.json b/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.mixins.json index fa529a5d4..88d22fb0d 100644 --- a/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.mixins.json +++ b/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.mixins.json @@ -6,7 +6,6 @@ "loot.BlockLootTableGeneratorMixin", "TagProviderMixin", "ModelProviderMixin", - "TagBuilderMixin", "DataGeneratorMixin" ], "injectors": {