Fabric Data Generation API ()

* First look at datagen

* First pass on item/block models

* Tags

* Advancements + BlockFamilies

* Loot tables

* Cleanup

* Start on javadocs, and cleanup

* Update for new mappings.

* Added client-side entrypoint and more logging.

* Complete javadoc, add modid filter and misc fixes/cleanup.

* Minor fixes.

* Renames and misc changes.

* Strict validation fixes.

* Apply suggestions from code review

Co-authored-by: Shnupbups <shnupbups@gmail.com>

* Update fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/FabricDataGenerator.java

Co-authored-by: Shnupbups <shnupbups@gmail.com>

* Update fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/FabricDataGenerator.java

Co-authored-by: Shnupbups <shnupbups@gmail.com>

* Review fixes.

* Set generated dir as resources not sources.

Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
Co-authored-by: Shnupbups <shnupbups@gmail.com>
This commit is contained in:
modmuss50 2021-12-03 13:35:29 +00:00 committed by GitHub
parent c8c981c1db
commit 3fec4ad922
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1807 additions and 3 deletions

View file

@ -219,9 +219,11 @@ subprojects {
dependencies {
testmodImplementation sourceSets.main.output
// Make all modules depend on the gametest api to try and promote its usage.
if (project.name != "fabric-gametest-api-v1")
// Make all modules depend on the gametest api (and thus res loader) to try and promote its usage.
if (project.name != "fabric-gametest-api-v1") {
testmodImplementation project(path: ':fabric-gametest-api-v1', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-resource-loader-v0', configuration: 'namedElements')
}
}
publishing {
@ -309,7 +311,8 @@ sourceSets {
// These modules are not included in the fat jar, maven will resolve them via the pom.
def devOnlyModules = [
"fabric-gametest-api-v1"
"fabric-gametest-api-v1",
"fabric-data-generation-api-v1"
]
dependencies {

View file

@ -0,0 +1 @@
/src/testmod/generated

View file

@ -0,0 +1,110 @@
archivesBaseName = "fabric-data-generation-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-registry-sync-v0',
'fabric-networking-api-v1'
])
sourceSets {
testmod {
resources {
srcDirs += [
'src/testmod/generated'
]
}
}
}
loom {
accessWidenerPath = file("src/main/resources/fabric-data-generation-api-v1.accesswidener")
runs {
datagen {
inherit testmodServer
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/testmod/generated")}"
vmArg "-Dfabric-api.datagen.strict-validation"
ideConfigGenerated = true
runDir "build/datagen"
}
datagenClient {
client()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/testmod/generated")}"
vmArg "-Dfabric-api.datagen.strict-validation"
ideConfigGenerated = true
runDir "build/datagen"
source sourceSets.testmod
}
}
}
assemble.dependsOn runDatagen
import org.objectweb.asm.ClassReader
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.ClassNode
import java.util.zip.ZipFile
task generateAccessWidener() {
doLast {
// This is using loom internals, dont copy from this.
File inputJar = loom.mappingsProvider.mappedProvider.baseMappedJar
String accessWidener = file("template.accesswidener").text + "\n"
visitMethods(inputJar, "net/minecraft/data/server/RecipesProvider.class") { name, desc, owner ->
if (it.name == "generate")
return
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
visitMethods(inputJar, "net/minecraft/data/client/model/BlockStateModelGenerator.class") { name, desc, owner ->
if (desc == "()V")
// Skip over methods that dont take any arguments, as they are specific to minecraft.
return
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
visitMethods(inputJar, "net/minecraft/data/server/BlockLootTableGenerator.class") { name, desc, owner ->
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
file("src/main/resources/fabric-data-generation-api-v1.accesswidener").text = accessWidener
}
}
def visitMethods(File input, String className, closure) {
def clazz = getClassNode(input, className)
clazz.methods.forEach {
if ((it.access & Opcodes.ACC_SYNTHETIC) != 0 || (it.access & Opcodes.ACC_PUBLIC) != 0)
return
if (it.name.startsWith("<"))
return
closure(it.name, it.desc, clazz.name)
}
}
ClassNode getClassNode(File input, String className) {
File inputJar = loom.mappingsProvider.mappedProvider.baseMappedJar
new ZipFile(inputJar).withCloseable { ZipFile zip ->
zip.getInputStream(zip.getEntry(className)).withCloseable { is ->
ClassReader reader = new ClassReader(is)
ClassNode classNode = new ClassNode()
reader.accept(classNode, 0)
return classNode
}
}
}

View file

@ -0,0 +1,34 @@
/*
* 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.api.datagen.v1;
/**
* An entry point for data generation.
*
* <p>In {@code fabric.mod.json}, the entrypoint is defined with {@code fabric-datagen} key.</p>
*
* @see FabricDataGenerator
*/
@FunctionalInterface
public interface DataGeneratorEntrypoint {
/**
* Register {@link net.minecraft.data.DataProvider} with the {@link FabricDataGenerator} during this entrypoint.
*
* @param fabricDataGenerator The {@link FabricDataGenerator} instance
*/
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator);
}

View file

@ -0,0 +1,81 @@
/*
* 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.api.datagen.v1;
import java.nio.file.Path;
import java.util.Collections;
import java.util.function.Function;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DataProvider;
import net.fabricmc.loader.api.ModContainer;
/**
* An extension to vanilla's {@link DataGenerator} providing mod specific data, and helper functions.
*/
public final class FabricDataGenerator extends DataGenerator {
private final ModContainer modContainer;
private final boolean strictValidation;
@ApiStatus.Internal
public FabricDataGenerator(Path output, ModContainer mod, boolean strictValidation) {
super(output, Collections.emptyList());
this.modContainer = mod;
this.strictValidation = strictValidation;
}
/**
* Helper overloaded method to aid with registering a {@link DataProvider} that has a single argument constructor for a {@link FabricDataGenerator}.
*
* @return The {@link DataProvider}
*/
public <P extends DataProvider> P addProvider(Function<FabricDataGenerator, P> provider) {
P p = provider.apply(this);
addProvider(p);
return p;
}
/**
* Returns the {@link ModContainer} for the mod that this data generator has been created for.
*
* @return a {@link ModContainer} instance
*/
public ModContainer getModContainer() {
return modContainer;
}
/**
* Returns the mod ID for the mod that this data generator has been created for.
*
* @return a mod ID
*/
public String getModId() {
return getModContainer().getMetadata().getId();
}
/**
* When enabled data providers can do strict validation to ensure that all entries have data generated for them.
*
* @return if strict validation should be enabled
*/
public boolean isStrictValidationEnabled() {
return strictValidation;
}
}

View file

@ -0,0 +1,24 @@
/*
* 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.
*/
/**
* The Data Generation API, version 1.
*
* <p>This API extends the data generation system used by Minecraft to allow for mods to generate data (json files) automatically
*
* <p>Use the {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint} to register {@link net.minecraft.data.DataProvider} with the {@link net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator}
*/
package net.fabricmc.fabric.api.datagen.v1;

View file

@ -0,0 +1,80 @@
/*
* 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.api.datagen.v1.provider;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Set;
import java.util.function.Consumer;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.advancement.Advancement;
import net.minecraft.data.DataCache;
import net.minecraft.data.DataProvider;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* Extend this class and implement {@link FabricAdvancementsProvider#generateAdvancement}.
*
* <p>Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class FabricAdvancementsProvider implements DataProvider {
private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create();
protected final FabricDataGenerator dataGenerator;
protected FabricAdvancementsProvider(FabricDataGenerator dataGenerator) {
this.dataGenerator = dataGenerator;
}
/**
* Implement this method to register advancements to generate use the consumer callback to register advancements.
*
* <p>Use {@link Advancement.Task#build(Consumer, String)} to help build advancements.
*/
public abstract void generateAdvancement(Consumer<Advancement> consumer);
@Override
public void run(DataCache cache) throws IOException {
final Set<Identifier> identifiers = Sets.newHashSet();
final Set<Advancement> advancements = Sets.newHashSet();
generateAdvancement(advancements::add);
for (Advancement advancement : advancements) {
if (!identifiers.add(advancement.getId())) {
throw new IllegalStateException("Duplicate advancement " + advancement.getId());
}
DataProvider.writeToPath(GSON, cache, advancement.createTask().toJson(), getOutputPath(advancement));
}
}
private Path getOutputPath(Advancement advancement) {
return dataGenerator.getOutput().resolve("data/%s/advancements/%s.json".formatted(advancement.getId().getNamespace(), advancement.getId().getPath()));
}
@Override
public String getName() {
return "Advancements";
}
}

View file

@ -0,0 +1,99 @@
/*
* 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.api.datagen.v1.provider;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import com.google.common.collect.Sets;
import net.minecraft.data.server.BlockLootTableGenerator;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTables;
import net.minecraft.loot.context.LootContextType;
import net.minecraft.loot.context.LootContextTypes;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* Extend this class and implement {@link FabricBlockLootTablesProvider#generateBlockLootTables}.
*
* <p>Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class FabricBlockLootTablesProvider extends BlockLootTableGenerator implements FabricLootTableProvider {
protected final FabricDataGenerator dataGenerator;
protected FabricBlockLootTablesProvider(FabricDataGenerator dataGenerator) {
this.dataGenerator = dataGenerator;
}
/**
* Implement this method to add block drops.
*
* <p>Use the range of {@link BlockLootTableGenerator#addDrop} methods to generate block drops.
*/
protected abstract void generateBlockLootTables();
@Override
public LootContextType getLootContextType() {
return LootContextTypes.BLOCK;
}
@Override
public FabricDataGenerator getFabricDataGenerator() {
return dataGenerator;
}
@Override
public void accept(BiConsumer<Identifier, LootTable.Builder> biConsumer) {
generateBlockLootTables();
for (Map.Entry<Identifier, LootTable.Builder> entry : lootTables.entrySet()) {
Identifier identifier = entry.getKey();
if (identifier.equals(LootTables.EMPTY)) {
continue;
}
biConsumer.accept(identifier, entry.getValue());
}
if (dataGenerator.isStrictValidationEnabled()) {
Set<Identifier> missing = Sets.newHashSet();
for (Identifier blockId : Registry.BLOCK.getIds()) {
if (blockId.getNamespace().equals(dataGenerator.getModId())) {
if (!lootTables.containsKey(Registry.BLOCK.get(blockId).getLootTableId())) {
missing.add(blockId);
}
}
}
if (!missing.isEmpty()) {
throw new IllegalStateException("Missing loot table(s) for %s".formatted(missing));
}
}
}
@Override
public String getName() {
return "Block Loot Tables";
}
}

View file

@ -0,0 +1,41 @@
/*
* 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.api.datagen.v1.provider;
import net.minecraft.data.client.BlockStateDefinitionProvider;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.model.BlockStateModelGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* Extend this class and implement {@link FabricBlockStateDefinitionProvider#generateBlockStateModels} and {@link FabricBlockStateDefinitionProvider#generateItemModels}.
*
* <p>Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class FabricBlockStateDefinitionProvider extends BlockStateDefinitionProvider {
protected final FabricDataGenerator dataGenerator;
public FabricBlockStateDefinitionProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
this.dataGenerator = dataGenerator;
}
public abstract void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator);
public abstract void generateItemModels(ItemModelGenerator itemModelGenerator);
}

View file

@ -0,0 +1,74 @@
/*
* 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.api.datagen.v1.provider;
import java.io.IOException;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.data.DataCache;
import net.minecraft.data.DataProvider;
import net.minecraft.loot.LootManager;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.context.LootContextType;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* A base interface for Loot table providers. You should not implement this class directly.
*
* <p>{@link FabricBlockLootTablesProvider} provides additional features specific to block drop loot tables.
*
* <p>Use {@link SimpleFabricLootTableProvider} for a simple abstract class that you can implement to handle standard loot table functions.
*/
@ApiStatus.NonExtendable
public interface FabricLootTableProvider extends Consumer<BiConsumer<Identifier, LootTable.Builder>>, DataProvider {
Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create();
LootContextType getLootContextType();
FabricDataGenerator getFabricDataGenerator();
@ApiStatus.Internal
@Override
default void run(DataCache cache) throws IOException {
HashMap<Identifier, LootTable> builders = Maps.newHashMap();
accept((identifier, builder) -> {
if (builders.put(identifier, builder.type(getLootContextType()).build()) != null) {
throw new IllegalStateException("Duplicate loot table " + identifier);
}
});
for (Map.Entry<Identifier, LootTable> entry : builders.entrySet()) {
DataProvider.writeToPath(GSON, cache, LootManager.toJson(entry.getValue()), getOutputPath(entry.getKey()));
}
}
private Path getOutputPath(Identifier lootTableId) {
return getFabricDataGenerator().getOutput().resolve("data/%s/loot_tables/%s.json".formatted(lootTableId.getNamespace(), lootTableId.getPath()));
}
}

View file

@ -0,0 +1,79 @@
/*
* 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.api.datagen.v1.provider;
import java.nio.file.Path;
import java.util.Set;
import java.util.function.Consumer;
import com.google.common.collect.Sets;
import com.google.gson.JsonObject;
import net.minecraft.data.DataCache;
import net.minecraft.data.server.RecipesProvider;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapedRecipeJsonFactory;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonFactory;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* Extend this class and implement {@link FabricRecipesProvider#generateRecipes}.
*
* <p>Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class FabricRecipesProvider extends RecipesProvider {
protected final FabricDataGenerator dataGenerator;
public FabricRecipesProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
this.dataGenerator = dataGenerator;
}
/**
* Implement this method and then use the range of methods in {@link RecipesProvider} or from one of the recipe json factories such as {@link ShapedRecipeJsonFactory} & {@link ShapelessRecipeJsonFactory}.
*/
protected abstract void generateRecipes(Consumer<RecipeJsonProvider> exporter);
@Override
public void run(DataCache cache) {
Path path = this.root.getOutput();
Set<Identifier> generatedRecipes = Sets.newHashSet();
generateRecipes(provider -> {
Identifier identifier = getRecipeIdentifier(provider.getRecipeId());
if (!generatedRecipes.add(identifier)) {
throw new IllegalStateException("Duplicate recipe " + identifier);
}
saveRecipe(cache, provider.toJson(), path.resolve("data/" + identifier.getNamespace() + "/recipes/" + identifier.getPath() + ".json"));
JsonObject jsonObject = provider.toAdvancementJson();
if (jsonObject != null) {
saveRecipeAdvancement(cache, jsonObject, path.resolve("data/" + identifier.getNamespace() + "/advancements/" + provider.getAdvancementId().getPath() + ".json"));
}
});
}
/**
* Override this method to change the recipe identifier. The default implementation normalizes the namespace to the mod ID.
*/
protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier(dataGenerator.getModId(), identifier.getPath());
}
}

View file

@ -0,0 +1,247 @@
/*
* 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.api.datagen.v1.provider;
import java.nio.file.Path;
import java.util.Objects;
import java.util.function.Function;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.Block;
import net.minecraft.data.DataProvider;
import net.minecraft.data.server.AbstractTagProvider;
import net.minecraft.entity.EntityType;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.event.GameEvent;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* Implement this class (or one of the inner classes) to generate a tag list.
*
* <p>Register your implementation using {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*
* <p>Commonly used implementations of this class are provided:
*
* @see BlockTagProvider
* @see ItemTagProvider
* @see FluidTagProvider
* @see EntityTypeTagProvider
* @see GameEventTagProvider
*/
public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
private final String path;
private final String name;
/**
* Construct a new {@link FabricTagProvider}.
*
* <p>Common implementations of this class are provided. For example @see BlockTagProvider
*
* @param dataGenerator The data generator instance
* @param registry The backing registry for the Tag type.
* @param path The directory name to write the tag file names. Example: "blocks" or "items"
* @param name The name used for {@link DataProvider#getName()}
*/
protected FabricTagProvider(FabricDataGenerator dataGenerator, Registry<T> registry, String path, String name) {
super(dataGenerator, registry);
this.path = path;
this.name = name;
}
/**
* Implement this method and then use {@link FabricTagProvider#getOrCreateTagBuilder} to get and register new tag builders.
*/
protected abstract void generateTags();
/**
* Creates a new instance of {@link FabricTagBuilder} for the given {@link net.minecraft.tag.Tag.Identified} tag.
*
* @param tag The {@link net.minecraft.tag.Tag.Identified} tag to create the builder for
* @return The {@link FabricTagBuilder} instance
*/
@Override
protected FabricTagBuilder<T> getOrCreateTagBuilder(Tag.Identified<T> tag) {
return new FabricTagBuilder<>(super.getOrCreateTagBuilder(tag));
}
@Override
protected Path getOutput(Identifier id) {
return this.root.getOutput().resolve("data/%s/tags/%s/%s.json".formatted(id.getNamespace(), path, id.getPath()));
}
@Override
protected final void configure() {
generateTags();
}
@Override
public String getName() {
return name;
}
/**
* Extend this class to create {@link Block} tags in the "/blocks" tag directory.
*/
public abstract static class BlockTagProvider extends FabricTagProvider<Block> {
public BlockTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator, Registry.BLOCK, "blocks", "Block Tags");
}
}
/**
* Extend this class to create {@link Item} tags in the "/items" tag directory.
*/
public abstract static class ItemTagProvider extends FabricTagProvider<Item> {
@Nullable
private final Function<Tag.Identified<Block>, Tag.Builder> blockTagBuilderProvider;
/**
* Construct an {@link ItemTagProvider} tag provider <b>with</b> an associated {@link BlockTagProvider} tag provider.
*
* @param dataGenerator a {@link ItemTagProvider} tag provider
*/
public ItemTagProvider(FabricDataGenerator dataGenerator, @Nullable FabricTagProvider.BlockTagProvider blockTagProvider) {
super(dataGenerator, Registry.ITEM, "items", "Item Tags");
this.blockTagBuilderProvider = blockTagProvider == null ? null : blockTagProvider::getTagBuilder;
}
/**
* Construct an {@link ItemTagProvider} tag provider <b>without</b> an associated {@link BlockTagProvider} tag provider.
*
* @param dataGenerator a {@link ItemTagProvider} tag provider
*/
public ItemTagProvider(FabricDataGenerator dataGenerator) {
this(dataGenerator, null);
}
/**
* Copy the entries from a tag with the {@link Block} type into this item tag.
*
* <p>The {@link ItemTagProvider} tag provider must be constructed with an associated {@link BlockTagProvider} tag provider to use this method.
*
* @param blockTag The block tag to copy from.
* @param itemTag The item tag to copy to.
*/
public void copy(Tag.Identified<Block> blockTag, Tag.Identified<Item> itemTag) {
Tag.Builder blockTagBuilder = Objects.requireNonNull(this.blockTagBuilderProvider, "Pass Block tag provider via constructor to use copy").apply(blockTag);
Tag.Builder itemTagBuilder = this.getTagBuilder(itemTag);
blockTagBuilder.streamEntries().forEach(itemTagBuilder::add);
}
}
/**
* Extend this class to create {@link Fluid} tags in the "/fluids" tag directory.
*/
public abstract static class FluidTagProvider extends FabricTagProvider<Fluid> {
public FluidTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator, Registry.FLUID, "fluids", "Fluid Tags");
}
}
/**
* Extend this class to create {@link EntityType} tags in the "/entity_types" tag directory.
*/
public abstract static class EntityTypeTagProvider extends FabricTagProvider<EntityType<?>> {
public EntityTypeTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator, Registry.ENTITY_TYPE, "entity_types", "Entity Type Tags");
}
}
/**
* Extend this class to create {@link GameEvent} tags in the "/game_events" tag directory.
*/
public abstract static class GameEventTagProvider extends FabricTagProvider<GameEvent> {
public GameEventTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator, Registry.GAME_EVENT, "game_events", "Game Event Tags");
}
}
/**
* An extension to {@link net.minecraft.data.server.AbstractTagProvider.ObjectBuilder} that provides additional functionality.
*/
public static class FabricTagBuilder<T> extends ObjectBuilder<T> {
private final AbstractTagProvider.ObjectBuilder<T> parent;
private FabricTagBuilder(ObjectBuilder<T> parent) {
super(parent.builder, parent.registry, parent.source);
this.parent = parent;
}
/**
* Set the value of the `replace` flag in a Tag.
*
* <p>When set to true the tag will replace any existing tag entries.
*
* @return the {@link FabricTagBuilder} instance
*/
public FabricTagBuilder<T> setReplace(boolean replace) {
((net.fabricmc.fabric.impl.datagen.FabricTagBuilder) builder).fabric_setReplace(replace);
return this;
}
/**
* Add a single element to the tag.
*
* @return the {@link FabricTagBuilder} instance
*/
@Override
public FabricTagBuilder<T> add(T element) {
parent.add(element);
return this;
}
/**
* Add an optional {@link Identifier} to the tag.
*
* @return the {@link FabricTagBuilder} instance
*/
@Override
public FabricTagBuilder<T> addOptional(Identifier id) {
parent.addOptional(id);
return this;
}
/**
* Add another tag to this tag.
*
* @return the {@link FabricTagBuilder} instance
*/
@Override
public FabricTagBuilder<T> addTag(Tag.Identified<T> tag) {
parent.addTag(tag);
return this;
}
/**
* Add another optional tag to this tag.
*
* @return the {@link FabricTagBuilder} instance
*/
@Override
public FabricTagBuilder<T> addOptionalTag(Identifier id) {
parent.addOptionalTag(id);
return this;
}
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.api.datagen.v1.provider;
import java.util.Objects;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.loot.context.LootContextType;
import net.minecraft.loot.context.LootContextTypes;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
/**
* Extend this class and implement {@link java.util.function.Consumer#accept}. Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class SimpleFabricLootTableProvider implements FabricLootTableProvider {
protected final FabricDataGenerator dataGenerator;
protected final LootContextType lootContextType;
public SimpleFabricLootTableProvider(FabricDataGenerator dataGenerator, LootContextType lootContextType) {
this.dataGenerator = dataGenerator;
this.lootContextType = lootContextType;
}
@ApiStatus.Internal
@Override
public final LootContextType getLootContextType() {
return lootContextType;
}
@ApiStatus.Internal
@Override
public final FabricDataGenerator getFabricDataGenerator() {
return dataGenerator;
}
@Override
public String getName() {
return Objects.requireNonNull(LootContextTypes.getId(lootContextType), "Could not get id for loot context type") + " Loot Table";
}
}

View file

@ -0,0 +1,92 @@
/*
* 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;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Objects;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.entrypoint.EntrypointContainer;
@ApiStatus.Internal
public final class FabricDataGenHelper {
private static final Logger LOGGER = LogManager.getLogger();
/**
* When enabled the dedicated server startup will be hijacked to run the data generators and then quit.
*/
public static final boolean ENABLED = System.getProperty("fabric-api.datagen") != null;
/**
* Sets the output directory for the generated data.
*/
private static final String OUTPUT_DIR = System.getProperty("fabric-api.datagen.output-dir");
/**
* When enabled providers can enable extra validation, such as ensuring all registry entries have data generated for them.
*/
private static final boolean STRICT_VALIDATION = System.getProperty("fabric-api.datagen.strict-validation") != null;
/**
* Filter to a specific mod ID with this property, useful if dependencies also have data generators.
*/
@Nullable
private static final String MOD_ID_FILTER = System.getProperty("fabric-api.datagen.modid");
/**
* Entrypoint key to register classes implementing {@link DataGeneratorEntrypoint}.
*/
private static final String ENTRYPOINT_KEY = "fabric-datagen";
private FabricDataGenHelper() {
}
public static void run() throws IOException {
Path outputDir = Paths.get(Objects.requireNonNull(OUTPUT_DIR, "No output dir provided with the 'fabric-api.datagen.output-dir' property"));
List<EntrypointContainer<DataGeneratorEntrypoint>> dataGeneratorInitializers = FabricLoader.getInstance()
.getEntrypointContainers(ENTRYPOINT_KEY, DataGeneratorEntrypoint.class);
if (dataGeneratorInitializers.isEmpty()) {
LOGGER.warn("No data generator entrypoints are defined. Implement {} and add your class to the '{}' entrypoint key in your fabric.mod.json.",
DataGeneratorEntrypoint.class.getName(), ENTRYPOINT_KEY);
}
for (EntrypointContainer<DataGeneratorEntrypoint> entrypointContainer : dataGeneratorInitializers) {
if (MOD_ID_FILTER != null) {
if (!entrypointContainer.getProvider().getMetadata().getId().equals(MOD_ID_FILTER)) {
continue;
}
}
LOGGER.info("Running data generator for {}", entrypointContainer.getProvider().getMetadata().getName());
FabricDataGenerator dataGenerator = new FabricDataGenerator(outputDir, entrypointContainer.getProvider(), STRICT_VALIDATION);
entrypointContainer.getEntrypoint().onInitializeDataGenerator(dataGenerator);
dataGenerator.run();
}
}
}

View file

@ -0,0 +1,24 @@
/*
* 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;
import org.jetbrains.annotations.ApiStatus;
@ApiStatus.Internal
public interface FabricTagBuilder {
void fabric_setReplace(boolean replace);
}

View file

@ -0,0 +1,117 @@
/*
* 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 java.util.Map;
import java.util.Set;
import java.util.function.Supplier;
import com.google.gson.JsonElement;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.Block;
import net.minecraft.data.DataCache;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.client.BlockStateDefinitionProvider;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.model.BlockStateModelGenerator;
import net.minecraft.data.client.model.BlockStateSupplier;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockStateDefinitionProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
@Mixin(BlockStateDefinitionProvider.class)
public class BlockStateDefinitionProviderMixin {
@Shadow
@Final
private DataGenerator generator;
@Unique
private static ThreadLocal<DataGenerator> dataGeneratorThreadLocal = new ThreadLocal<>();
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/model/BlockStateModelGenerator;register()V"))
private void registerBlockStateModels(BlockStateModelGenerator instance) {
if (((Object) this) instanceof FabricBlockStateDefinitionProvider fabricBlockStateDefinitionProvider) {
fabricBlockStateDefinitionProvider.generateBlockStateModels(instance);
} else {
// Fallback to the vanilla registration when not a fabric provider
instance.register();
}
}
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/ItemModelGenerator;register()V"))
private void registerItemModels(ItemModelGenerator instance) {
if (((Object) this) instanceof FabricBlockStateDefinitionProvider fabricBlockStateDefinitionProvider) {
fabricBlockStateDefinitionProvider.generateItemModels(instance);
} else {
// Fallback to the vanilla registration when not a fabric provider
instance.register();
}
}
@Inject(method = "run", at = @At("HEAD"))
private void runHead(DataCache cache, CallbackInfo ci) {
dataGeneratorThreadLocal.set(generator);
}
@Inject(method = "run", at = @At("TAIL"))
private void runTail(DataCache cache, CallbackInfo ci) {
dataGeneratorThreadLocal.remove();
}
@Inject(method = "method_25738", at = @At("HEAD"), cancellable = true)
private static void filterBlocksForProcessingMod(Map<Block, BlockStateSupplier> map, Block block, CallbackInfoReturnable<Boolean> cir) {
if (dataGeneratorThreadLocal.get() instanceof FabricDataGenerator dataGenerator) {
if (!dataGenerator.isStrictValidationEnabled()) {
cir.setReturnValue(false);
return;
}
if (!Registry.BLOCK.getId(block).getNamespace().equals(dataGenerator.getModId())) {
// Skip over blocks that are not from the mod we are processing.
cir.setReturnValue(false);
}
}
}
@Inject(method = "method_25741", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/model/ModelIds;getItemModelId(Lnet/minecraft/item/Item;)Lnet/minecraft/util/Identifier;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
private static void filterItemsForProcessingMod(Set<Item> set, Map<Identifier, Supplier<JsonElement>> map, Block block, CallbackInfo ci, Item item) {
if (dataGeneratorThreadLocal.get() instanceof FabricDataGenerator dataGenerator) {
if (!dataGenerator.isStrictValidationEnabled()) {
ci.cancel();
return;
}
if (!Registry.ITEM.getId(item).getNamespace().equals(dataGenerator.getModId())) {
// Skip over any items from other mods.
ci.cancel();
}
}
}
}

View file

@ -0,0 +1,45 @@
/*
* 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 org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import net.minecraft.tag.Tag;
import net.fabricmc.fabric.impl.datagen.FabricTagBuilder;
/**
* Extends Tag.Builder to support setting the replace field.
*/
@Mixin(Tag.Builder.class)
public class TagBuilderMixin implements FabricTagBuilder {
@Unique
private boolean replace = false;
@Override
public void fabric_setReplace(boolean replace) {
this.replace = replace;
}
@ModifyArg(method = "toJson", at = @At(value = "INVOKE", target = "Lcom/google/gson/JsonObject;addProperty(Ljava/lang/String;Ljava/lang/Boolean;)V"), index = 1)
public Boolean modifyReplace(Boolean replace) {
return this.replace;
}
}

View file

@ -0,0 +1,43 @@
/*
* 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.client;
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.callback.CallbackInfo;
import net.minecraft.client.MinecraftClient;
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;getBackendDescription()Ljava/lang/String;"))
private void main(CallbackInfo info) {
if (FabricDataGenHelper.ENABLED) {
try {
FabricDataGenHelper.run();
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
System.exit(0);
}
}
}

View file

@ -0,0 +1,39 @@
/*
* 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.server;
import java.io.IOException;
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.callback.CallbackInfo;
import net.minecraft.server.Main;
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
@Mixin(Main.class)
public class MainMixin {
@Inject(method = "main", at = @At(value = "NEW", target = "net/minecraft/server/dedicated/ServerPropertiesLoader"), cancellable = true)
private static void main(String[] args, CallbackInfo info) throws IOException {
if (FabricDataGenHelper.ENABLED) {
FabricDataGenHelper.run();
info.cancel();
}
}
}

Binary file not shown.

After

(image error) Size: 1.5 KiB

View file

@ -0,0 +1,222 @@
accessWidener v2 named
accessible field net/minecraft/data/server/RecipesProvider root Lnet/minecraft/data/DataGenerator;
extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder <init> (Lnet/minecraft/tag/Tag$Builder;Lnet/minecraft/util/registry/Registry;Ljava/lang/String;)V
accessible field net/minecraft/data/server/AbstractTagProvider$ObjectBuilder builder Lnet/minecraft/tag/Tag$Builder;
accessible field net/minecraft/data/server/AbstractTagProvider$ObjectBuilder registry Lnet/minecraft/util/registry/Registry;
accessible field net/minecraft/data/server/AbstractTagProvider$ObjectBuilder source Ljava/lang/String;
accessible field net/minecraft/data/server/BlockLootTableGenerator lootTables Ljava/util/Map;
transitive-accessible method net/minecraft/data/family/BlockFamilies register (Lnet/minecraft/block/Block;)Lnet/minecraft/data/family/BlockFamily$Builder;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider saveRecipe (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider saveRecipeAdvancement (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider generate (Ljava/util/function/Consumer;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerSingleOutputShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;I)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerSmelting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBlasting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerMultipleOptions (Ljava/util/function/Consumer;Lnet/minecraft/recipe/CookingRecipeSerializer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerNetheriteUpgradeRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerPlanksRecipe2 (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/tag/Tag;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerPlanksRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/tag/Tag;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBarkBlockRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBoatRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider createTransmutationRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createDoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createFenceRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createFenceGateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createPressurePlateRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider createPressurePlateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider offerSlabRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider createSlabRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createStairsRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createTrapdoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createSignRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider offerWoolDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCarpetRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCarpetDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBedRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBedDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBannerRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStainedGlassDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStainedGlassPaneRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStainedGlassPaneDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerTerracottaDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerConcretePowderDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStonecuttingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStonecuttingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;I)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCrackingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipes (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipesWithCompactedItemGroup (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipesWithInputItemGroup (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipes (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider generateCookingRecipes (Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/recipe/CookingRecipeSerializer;I)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCookingRecipe (Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/recipe/CookingRecipeSerializer;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerWaxingRecipes (Ljava/util/function/Consumer;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider generateFamily (Ljava/util/function/Consumer;Lnet/minecraft/data/family/BlockFamily;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider getVariantRecipeInput (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/data/family/BlockFamily$Variant;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/data/server/RecipesProvider requireEnteringFluid (Lnet/minecraft/block/Block;)Lnet/minecraft/advancement/criterion/EnterBlockCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromItem (Lnet/minecraft/predicate/NumberRange$IntRange;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromItem (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromTag (Lnet/minecraft/tag/Tag;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromItemPredicates ([Lnet/minecraft/predicate/item/ItemPredicate;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider hasItem (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getRecipeName (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider convertBetween (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getSmeltingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getBlastingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createStoneState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/Texture;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createDeepslateState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/Texture;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator excludeFromSimpleItemModelGeneration (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerParentedItemModel (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerParentedItemModel (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerItemModel (Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerItemModel (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerItemModel (Lnet/minecraft/block/Block;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createNorthDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSouthDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createEastDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createNorthDefaultRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createBlockStateWithRandomHorizontalRotations (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createModelVariantWithRandomHorizontalRotations (Lnet/minecraft/util/Identifier;)[Lnet/minecraft/data/client/model/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createBlockStateWithTwoModelAndRandomInversion (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createBooleanModelMap (Lnet/minecraft/state/property/BooleanProperty;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerMirrorable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRotatable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createButtonBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator fillDoorVariantMap (Lnet/minecraft/data/client/model/BlockStateVariantMap$QuadrupleProperty;Lnet/minecraft/block/enums/DoubleBlockHalf;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateVariantMap$QuadrupleProperty;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createDoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createFenceBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createWallBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createFenceGateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createStairsBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createOrientableTrapdoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createTrapdoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSingletonBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createAxisRotatedVariantMap ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNorthDefaultHorizontalRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSubModel (Lnet/minecraft/block/Block;Ljava/lang/String;Lnet/minecraft/data/client/model/Model;Ljava/util/function/Function;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createPressurePlateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSlabBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSimpleCubeAll (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSingleton (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSingleton (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/Texture;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCubeAllModelTexturePool (Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$BlockTexturePool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerDoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerOrientableTrapdoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTrapdoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerLog (Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$LogTexturePool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSimpleState (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerStateWithModelReference (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCross (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCross (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCrossBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCrossBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerFlowerPotPlant (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCoralFan (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerGourd (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCoral (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerDoubleBlock (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerDoubleBlock (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTurnableRail (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerStraightRail (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltin (Lnet/minecraft/util/Identifier;Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$BuiltinModelPool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltin (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$BuiltinModelPool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltinWithParticle (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltinWithParticle (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCarpet (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRandomHorizontalRotations (Lnet/minecraft/data/client/model/TexturedModel$Factory;[Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSouthDefaultHorizontalFacing (Lnet/minecraft/data/client/model/TexturedModel$Factory;[Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerGlassPane (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCommandBlock (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAnvil (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getBambooBlockStateVariants (I)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createUpDefaultFacingVariantMap ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createValueFencedModelMap (Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBeehive (Lnet/minecraft/block/Block;Ljava/util/function/Function;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCrop (Lnet/minecraft/block/Block;Lnet/minecraft/state/property/Property;[I)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCooker (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCampfire ([Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAzalea (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPottedAzaleaBush (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerMushroomBlock (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCubeWithCustomTexture (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Ljava/util/function/BiFunction;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNorthDefaultHorizontalRotatable (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerFurnaceLikeOrientable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAmethyst (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getDripstoneVariant (Lnet/minecraft/util/math/Direction;Lnet/minecraft/block/enums/Thickness;)Lnet/minecraft/data/client/model/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNetherrackBottomCustomTop (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRod (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getFireFloorModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getFireSideModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getFireUpModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator buildBlockStateVariants (Ljava/util/List;Ljava/util/function/UnaryOperator;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerLantern (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTopSoil (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/BlockStateVariant;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPressurePlate (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerInfested (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNorthDefaultHorizontalRotation (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPiston (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTorch (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getTurtleEggModel (ILjava/lang/String;Lnet/minecraft/data/client/model/Texture;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getTurtleEggModel (Ljava/lang/Integer;Ljava/lang/Integer;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerWallPlant (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerShulkerBox (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPlantPart (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBed (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRoots (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator addJigsawOrientationToVariant (Lnet/minecraft/block/enums/JigsawOrientation;Lnet/minecraft/data/client/model/BlockStateVariant;)Lnet/minecraft/data/client/model/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCandle (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator applyExplosionDecay (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/function/LootFunctionConsumingBuilder;)Ljava/lang/Object;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator addSurvivesExplosionCondition (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/condition/LootConditionConsumingBuilder;)Ljava/lang/Object;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/loot/condition/LootCondition$Builder;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouch (Lnet/minecraft/block/Block;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithShears (Lnet/minecraft/block/Block;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouchOrShears (Lnet/minecraft/block/Block;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/provider/number/LootNumberProvider;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/provider/number/LootNumberProvider;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouch (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator pottedPlantDrops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator slabDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithProperty (Lnet/minecraft/block/Block;Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator nameableContainerDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator shulkerBoxDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator copperOreDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator lapisOreDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator redstoneOreDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator bannerDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator beeNestDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator beehiveDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator glowBerryDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator oreDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator mushroomBlockDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator grassDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator cropStemDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator attachedCropStemDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithShears (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator glowLichenDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator leavesDrop (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator oakLeavesDrop (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator cropDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/loot/condition/LootCondition$Builder;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator seagrassDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator tallGrassDrops (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator candleDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator candleCakeDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator addVinePlantDrop (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator addDrop (Lnet/minecraft/block/Block;Ljava/util/function/Function;)V
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator addDrop (Lnet/minecraft/block/Block;Lnet/minecraft/loot/LootTable$Builder;)V

View file

@ -0,0 +1,18 @@
{
"required": true,
"package": "net.fabricmc.fabric.mixin.datagen",
"compatibilityLevel": "JAVA_16",
"mixins": [
"BlockStateDefinitionProviderMixin",
"TagBuilderMixin"
],
"client": [
"client.MinecraftClientMixin"
],
"server": [
"server.MainMixin"
],
"injectors": {
"defaultRequire": 1
}
}

View file

@ -0,0 +1,29 @@
{
"schemaVersion": 1,
"id": "fabric-data-generation-api-v1",
"name": "Fabric Data Generation API (v1)",
"version": "${version}",
"environment": "*",
"license": "Apache-2.0",
"icon": "assets/fabric-data-generation-api-v1/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.12.0"
},
"description": "Allows for automatic data generation.",
"mixins": [
"fabric-data-generation-api-v1.mixins.json"
],
"accessWidener" : "fabric-data-generation-api-v1.accesswidener",
"custom": {
"fabric-api:module-lifecycle": "stable"
}
}

View file

@ -0,0 +1,50 @@
/*
* 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 java.util.Objects;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.fabricmc.api.ModInitializer;
public class DataGeneratorTestContent implements ModInitializer {
public static final String MOD_ID = "fabric-data-gen-api-v1-testmod";
public static Block SIMPLE_BLOCK;
@Override
public void onInitialize() {
SIMPLE_BLOCK = createBlock("simple_block");
}
private static Block createBlock(String name) {
Identifier identifier = new Identifier(MOD_ID, name);
Block block = Registry.register(Registry.BLOCK, identifier, new Block(AbstractBlock.Settings.of(Material.STONE)));
Registry.register(Registry.ITEM, identifier, new BlockItem(block, new Item.Settings().group(ItemGroup.MISC)));
Objects.requireNonNull(block.asItem().getGroup());
return block;
}
}

View file

@ -0,0 +1,160 @@
/*
* 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 static net.fabricmc.fabric.test.datagen.DataGeneratorTestContent.MOD_ID;
import static net.fabricmc.fabric.test.datagen.DataGeneratorTestContent.SIMPLE_BLOCK;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementFrame;
import net.minecraft.advancement.criterion.OnKilledCriterion;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.model.BlockStateModelGenerator;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTables;
import net.minecraft.loot.context.LootContextTypes;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.ItemTags;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricAdvancementsProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTablesProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockStateDefinitionProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipesProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider;
public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
dataGenerator.addProvider(TestRecipeProvider::new);
dataGenerator.addProvider(TestBlockStateDefinitionProvider::new);
dataGenerator.addProvider(TestAdvancementsProvider::new);
dataGenerator.addProvider(TestBlockLootTablesProvider::new);
dataGenerator.addProvider(TestBarterLootTablesProvider::new);
TestBlockTagsProvider blockTagsProvider = dataGenerator.addProvider(TestBlockTagsProvider::new);
dataGenerator.addProvider(new TestItemTagsProvider(dataGenerator, blockTagsProvider));
}
private static class TestRecipeProvider extends FabricRecipesProvider {
private TestRecipeProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
}
@Override
protected void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
offerPlanksRecipe2(exporter, SIMPLE_BLOCK, ItemTags.ACACIA_LOGS);
}
}
private static class TestBlockStateDefinitionProvider extends FabricBlockStateDefinitionProvider {
private TestBlockStateDefinitionProvider(FabricDataGenerator generator) {
super(generator);
}
@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
blockStateModelGenerator.registerSimpleCubeAll(SIMPLE_BLOCK);
}
@Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
//itemModelGenerator.register(item, Models.SLAB);
}
}
private static class TestBlockTagsProvider extends FabricTagProvider.BlockTagProvider {
private TestBlockTagsProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
}
@Override
protected void generateTags() {
getOrCreateTagBuilder(BlockTags.FIRE).add(SIMPLE_BLOCK);
getOrCreateTagBuilder(BlockTags.ANVIL).setReplace(true).add(SIMPLE_BLOCK);
}
}
private static class TestItemTagsProvider extends FabricTagProvider.ItemTagProvider {
private TestItemTagsProvider(FabricDataGenerator dataGenerator, BlockTagProvider blockTagProvider) {
super(dataGenerator, blockTagProvider);
}
@Override
protected void generateTags() {
copy(BlockTags.ANVIL, ItemTags.ANVIL);
}
}
private static class TestAdvancementsProvider extends FabricAdvancementsProvider {
private TestAdvancementsProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
}
@Override
public void generateAdvancement(Consumer<Advancement> consumer) {
Advancement root = Advancement.Task.create()
.display(
SIMPLE_BLOCK,
new TranslatableText("advancements.test.root.title"),
new TranslatableText("advancements.test.root.description"),
new Identifier("textures/gui/advancements/backgrounds/end.png"),
AdvancementFrame.TASK,
false, false, false)
.criterion("killed_something", OnKilledCriterion.Conditions.createPlayerKilledEntity())
.build(consumer, MOD_ID + ":test/root");
}
}
private static class TestBlockLootTablesProvider extends FabricBlockLootTablesProvider {
private TestBlockLootTablesProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
}
@Override
protected void generateBlockLootTables() {
addDrop(SIMPLE_BLOCK);
}
}
private static class TestBarterLootTablesProvider extends SimpleFabricLootTableProvider {
private TestBarterLootTablesProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator, LootContextTypes.BARTER);
}
@Override
public void accept(BiConsumer<Identifier, LootTable.Builder> consumer) {
consumer.accept(
LootTables.PIGLIN_BARTERING_GAMEPLAY,
LootTable.builder().pool(
LootPool.builder().rolls(ConstantLootNumberProvider.create(1.0F)).with(ItemEntry.builder(SIMPLE_BLOCK))
)
);
}
}
}

View file

@ -0,0 +1,18 @@
{
"schemaVersion": 1,
"id": "fabric-data-gen-api-v1-testmod",
"name": "Fabric Data Generation API (v1) Test Mod",
"version": "1.0.0",
"environment": "*",
"license": "Apache-2.0",
"depends": {
},
"entrypoints": {
"main": [
"net.fabricmc.fabric.test.datagen.DataGeneratorTestContent"
],
"fabric-datagen": [
"net.fabricmc.fabric.test.datagen.DataGeneratorTestEntrypoint"
]
}
}

View file

@ -0,0 +1,16 @@
accessWidener v2 named
accessible field net/minecraft/data/server/RecipesProvider root Lnet/minecraft/data/DataGenerator;
extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder <init> (Lnet/minecraft/tag/Tag$Builder;Lnet/minecraft/util/registry/Registry;Ljava/lang/String;)V
accessible field net/minecraft/data/server/AbstractTagProvider$ObjectBuilder builder Lnet/minecraft/tag/Tag$Builder;
accessible field net/minecraft/data/server/AbstractTagProvider$ObjectBuilder registry Lnet/minecraft/util/registry/Registry;
accessible field net/minecraft/data/server/AbstractTagProvider$ObjectBuilder source Ljava/lang/String;
accessible field net/minecraft/data/server/BlockLootTableGenerator lootTables Ljava/util/Map;
transitive-accessible method net/minecraft/data/family/BlockFamilies register (Lnet/minecraft/block/Block;)Lnet/minecraft/data/family/BlockFamily$Builder;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/data/client/model/Model;)V

View file

@ -17,6 +17,7 @@ fabric-commands-v0-version=0.2.5
fabric-containers-v0-version=0.1.18
fabric-content-registries-v0-version=0.4.5
fabric-crash-report-info-v1-version=0.1.8
fabric-data-generation-api-v1-version=0.0.1
fabric-dimensions-v1-version=2.1.7
fabric-entity-events-v1-version=1.4.5
fabric-events-interaction-v0-version=0.4.15

View file

@ -21,6 +21,7 @@ include 'fabric-command-api-v1'
include 'fabric-containers-v0'
include 'fabric-content-registries-v0'
include 'fabric-crash-report-info-v1'
include 'fabric-data-generation-api-v1'
include 'fabric-dimensions-v1'
include 'fabric-entity-events-v1'
include 'fabric-events-interaction-v0'