diff --git a/README.md b/README.md index c5637c9..4342499 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,9 @@ include "me.shedaniel.cloth.api:cloth-api:${project.cloth_api_version}" #### cloth-durability-bar-api-v1 **To be implemented:** - DurabilityBarItem: Custom durability bar display +#### cloth-dynamic-registry-api-v1 +Events for listening to dynamic registries and api to add features and structures to biomes. +https://gist.github.com/shedaniel/1f819e811cefa59e414ef9f6c6d121db #### cloth-scissors-api-v1 **Utils:** - ScissorsStack: Stacking support for scissors diff --git a/build.gradle b/build.gradle index 9f35b4a..225e068 100755 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,8 @@ plugins { id 'com.jfrog.bintray' version '1.8.4' } +import net.fabricmc.loom.task.RunClientTask + version = project.mod_version logger.lifecycle("Building cloth-api: " + version) archivesBaseName = "cloth-api" @@ -39,12 +41,25 @@ allprojects { sourceCompatibility = targetCompatibility = 1.8 group = "me.shedaniel.cloth.api" + + ext { + shouldGenerateData = false + } sourceSets { testmod { compileClasspath += main.compileClasspath runtimeClasspath += main.runtimeClasspath } + main { + resources { + srcDir 'src/generated/resources' + } + } + datagen { + compileClasspath += main.compileClasspath + runtimeClasspath += main.runtimeClasspath + } } repositories { @@ -96,6 +111,16 @@ allprojects { header rootProject.file('HEADER') include '**/*.java' } + + if (shouldGenerateData) { + task generateData(type: RunClientTask, dependsOn: downloadAssets) { + classpath = configurations.runtimeClasspath + classpath sourceSets.main.output + classpath sourceSets.datagen.output + } + + build.dependsOn generateData + } } task sourcesJar(type: Jar, dependsOn: classes) { @@ -119,6 +144,7 @@ subprojects { dependencies { testmodCompile sourceSets.main.output + datagenCompile sourceSets.main.output } task remapMavenJar(type: Copy, dependsOn: remapJar) { @@ -228,6 +254,7 @@ subprojects.each { remapJar.dependsOn("${it.path}:remapJar") } sourceSets { testmod + datagen } dependencies { diff --git a/cloth-datagen-api-v1/build.gradle b/cloth-datagen-api-v1/build.gradle new file mode 100755 index 0000000..a100cf2 --- /dev/null +++ b/cloth-datagen-api-v1/build.gradle @@ -0,0 +1,6 @@ +archivesBaseName = "cloth-datagen-api-v1" +shouldGenerateData = false + +minecraft { + accessWidener(file("src/main/resources/cloth-datagen-api-v1.accessWidener")) +} \ No newline at end of file diff --git a/cloth-datagen-api-v1/src/datagen/java/me/shedaniel/cloth/test/datagen/TestDatagen.java b/cloth-datagen-api-v1/src/datagen/java/me/shedaniel/cloth/test/datagen/TestDatagen.java new file mode 100644 index 0000000..f444ce9 --- /dev/null +++ b/cloth-datagen-api-v1/src/datagen/java/me/shedaniel/cloth/test/datagen/TestDatagen.java @@ -0,0 +1,81 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.test.datagen; + +import me.shedaniel.cloth.api.datagen.v1.DataGeneratorHandler; +import me.shedaniel.cloth.api.datagen.v1.LootTableData; +import me.shedaniel.cloth.api.datagen.v1.RecipeData; +import me.shedaniel.cloth.api.datagen.v1.TagData; +import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; +import net.minecraft.advancement.criterion.ImpossibleCriterion; +import net.minecraft.block.Blocks; +import net.minecraft.data.server.recipe.ShapelessRecipeJsonFactory; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.Items; +import net.minecraft.tag.ItemTags; +import net.minecraft.util.Identifier; + +import java.nio.file.Paths; + +public class TestDatagen implements PreLaunchEntrypoint { + @Override + public void onPreLaunch() { + try { + DataGeneratorHandler handler = DataGeneratorHandler.create(Paths.get("../cloth-datagen-api-v1/src/generated/resource")); + + LootTableData table = handler.getLootTables(); + table.registerBlockDropSelf(Blocks.DIAMOND_BLOCK); + table.registerBlockDrop(Blocks.IRON_BLOCK, Items.ACACIA_FENCE); + table.register(Blocks.COAL_BLOCK, LootTableData.dropsBlockWithShears(Items.ACACIA_DOOR)); + table.register(Blocks.BONE_BLOCK, LootTableData.dropsBlockWithSilkTouch(Items.DIAMOND)); + table.register(Blocks.ACACIA_SLAB, LootTableData.dropsSlabs(Blocks.ACACIA_SLAB)); + + TagData tag = handler.getTags(); + tag.block(new Identifier("thing")).append(Blocks.ACACIA_FENCE); + TagData.TagBuilder thing = tag.item(new Identifier("thing")).append(Blocks.ACACIA_FENCE); + tag.item(new Identifier("awesome")).append(Blocks.BIRCH_SAPLING, Items.IRON_AXE).appendTag(ItemTags.ANVIL).appendTag(thing); + + RecipeData recipes = handler.getRecipes(); + ShapelessRecipeJsonFactory.create(Items.STONE) + .criterion("impossible", new ImpossibleCriterion.Conditions()) + .input(Items.SPONGE) + .input(Items.SPONGE) + .input(Items.SPONGE) + .input(Items.SPONGE) + .input(Items.SPONGE) + .input(Items.SPONGE) + .offerTo(recipes); + + handler.run(); + } catch (Throwable throwable) { + throwable.printStackTrace(); + System.exit(1); + } + System.exit(0); + } +} diff --git a/cloth-datagen-api-v1/src/datagen/resources/fabric.mod.json b/cloth-datagen-api-v1/src/datagen/resources/fabric.mod.json new file mode 100644 index 0000000..8cbc489 --- /dev/null +++ b/cloth-datagen-api-v1/src/datagen/resources/fabric.mod.json @@ -0,0 +1,24 @@ +{ + "schemaVersion": 1, + "id": "cloth-datagen-api-v1-datagen", + "name": "Cloth Datagen v1: Datagen", + "description": "API for easier datagens", + "version": "${version}", + "authors": [ + "shedaniel" + ], + "contact": { + "homepage": "https://www.curseforge.com/minecraft/mc-mods/cloth-api", + "sources": "https://github.com/shedaniel/cloth-api", + "issues": "https://github.com/shedaniel/cloth-api/issues" + }, + "entrypoints": { + "preLaunch": ["me.shedaniel.cloth.test.datagen.TestDatagen"] + }, + "license": "Unlicense", + "environment": "*", + "custom": { + "modmenu:api": true, + "modmenu:parent": "cloth-api" + } +} \ No newline at end of file diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/DataGeneratorHandler.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/DataGeneratorHandler.java new file mode 100644 index 0000000..be792bd --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/DataGeneratorHandler.java @@ -0,0 +1,66 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.api.datagen.v1; + +import me.shedaniel.cloth.impl.datagen.DataGeneratorHandlerImpl; +import net.minecraft.Bootstrap; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.DataProvider; + +import java.nio.file.Path; +import java.util.Collection; +import java.util.Collections; + +public interface DataGeneratorHandler extends Runnable { + static DataGeneratorHandler create(Path output) { + Bootstrap.initialize(); + DataGenerator generator = new DataGenerator(output.toAbsolutePath().normalize(), Collections.emptyList()); + + return new DataGeneratorHandlerImpl(generator); + } + + default void install(DataProvider dataProvider) { + getDataGenerator().install(dataProvider); + } + + default Collection getInputs() { + return getDataGenerator().getInputs(); + } + + default Path getOutput() { + return getDataGenerator().getOutput(); + } + + DataGenerator getDataGenerator(); + + LootTableData getLootTables(); + + TagData getTags(); + + RecipeData getRecipes(); +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/LootTableData.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/LootTableData.java new file mode 100644 index 0000000..bd76ffc --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/LootTableData.java @@ -0,0 +1,87 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.api.datagen.v1; + +import net.minecraft.block.Block; +import net.minecraft.data.server.BlockLootTableGenerator; +import net.minecraft.entity.EntityType; +import net.minecraft.item.ItemConvertible; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.condition.LootCondition; +import net.minecraft.loot.context.LootContextType; +import net.minecraft.loot.context.LootContextTypes; +import net.minecraft.loot.entry.LootPoolEntry; +import net.minecraft.util.Identifier; + +public interface LootTableData { + void register(LootContextType type, Identifier identifier, LootTable.Builder lootTable); + + default void register(Block block, LootTable.Builder lootTable) { + register(LootContextTypes.BLOCK, block.getLootTableId(), lootTable); + } + + default void register(EntityType entityType, LootTable.Builder lootTable) { + register(LootContextTypes.ENTITY, entityType.getLootTableId(), lootTable); + } + + default void registerBlockDropSelf(Block block) { + this.registerBlockDrop(block, block); + } + + default void registerBlockDropSelfRequiresSilkTouch(Block block) { + this.registerBlockDropRequiresSilkTouch(block, block); + } + + default void registerBlockDrop(Block block, ItemConvertible drop) { + this.register(block, dropsBlock(drop)); + } + + default void registerBlockDropRequiresSilkTouch(Block block, ItemConvertible drop) { + this.register(block, dropsBlockWithSilkTouch(drop)); + } + + static LootTable.Builder dropsBlock(ItemConvertible drop) { + return BlockLootTableGenerator.drops(drop); + } + + static LootTable.Builder dropsBlock(Block drop, LootCondition.Builder conditionBuilder, LootPoolEntry.Builder child) { + return BlockLootTableGenerator.drops(drop, conditionBuilder, child); + } + + static LootTable.Builder dropsBlockWithSilkTouch(ItemConvertible drop) { + return BlockLootTableGenerator.dropsWithSilkTouch(drop); + } + + static LootTable.Builder dropsBlockWithShears(ItemConvertible drop) { + return BlockLootTableGenerator.createForBlockNeedingShears(drop); + } + + static LootTable.Builder dropsSlabs(Block drop) { + return BlockLootTableGenerator.createForSlabs(drop); + } +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/RecipeData.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/RecipeData.java new file mode 100644 index 0000000..56c3276 --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/RecipeData.java @@ -0,0 +1,36 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.api.datagen.v1; + +import net.minecraft.data.server.recipe.RecipeJsonProvider; + +import java.util.function.Consumer; + +public interface RecipeData extends Consumer { + +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/TagData.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/TagData.java new file mode 100644 index 0000000..b5147f5 --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/api/datagen/v1/TagData.java @@ -0,0 +1,82 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.api.datagen.v1; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityType; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; +import net.minecraft.tag.Tag; +import net.minecraft.util.Identifier; + +public interface TagData { + TagBuilder block(Identifier tag); + + TagBuilder item(Identifier tag); + + TagBuilder> entity(Identifier tag); + + TagBuilder fluid(Identifier tag); + + default TagBuilder block(Tag.Identified tag) { + return block(tag.getId()); + } + + default TagBuilder item(Tag.Identified tag) { + return item(tag.getId()); + } + + default TagBuilder> entity(Tag.Identified> tag) { + return entity(tag.getId()); + } + + default TagBuilder fluid(Tag.Identified tag) { + return fluid(tag.getId()); + } + + interface TagBuilder { + Identifier getId(); + + TagBuilder append(Identifier value); + + TagBuilder append(T value); + + TagBuilder append(T... values); + + TagBuilder appendTag(Identifier tag); + + default TagBuilder appendTag(Tag.Identified tag) { + return appendTag(tag.getId()); + } + + default TagBuilder appendTag(TagBuilder tag) { + return appendTag(tag.getId()); + } + } +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/DataGeneratorHandlerImpl.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/DataGeneratorHandlerImpl.java new file mode 100644 index 0000000..cc1689f --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/DataGeneratorHandlerImpl.java @@ -0,0 +1,80 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.impl.datagen; + +import me.shedaniel.cloth.api.datagen.v1.LootTableData; +import me.shedaniel.cloth.api.datagen.v1.RecipeData; +import me.shedaniel.cloth.api.datagen.v1.TagData; +import net.minecraft.data.DataGenerator; +import net.minecraft.util.Lazy; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; + +public class DataGeneratorHandlerImpl implements me.shedaniel.cloth.api.datagen.v1.DataGeneratorHandler { + private static final Logger LOGGER = LogManager.getLogger(); + private final DataGenerator dataGenerator; + private final Lazy lootTableGenerator = new Lazy<>(() -> new LootTableDataProvider(this)); + private final Lazy tagDataProvider = new Lazy<>(() -> new TagDataProvider(this)); + private final Lazy recipeDataProvider = new Lazy<>(() -> new RecipeDataProvider(this)); + + public DataGeneratorHandlerImpl(DataGenerator dataGenerator) { + this.dataGenerator = dataGenerator; + } + + @Override + public DataGenerator getDataGenerator() { + return dataGenerator; + } + + @Override + public LootTableData getLootTables() { + return lootTableGenerator.get(); + } + + @Override + public TagData getTags() { + return tagDataProvider.get(); + } + + @Override + public RecipeData getRecipes() { + return recipeDataProvider.get(); + } + + @Override + public void run() { + LOGGER.info("Starting datagen in: " + getOutput().toString()); + try { + this.dataGenerator.run(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/LootTableDataProvider.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/LootTableDataProvider.java new file mode 100644 index 0000000..996553c --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/LootTableDataProvider.java @@ -0,0 +1,95 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.impl.datagen; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import me.shedaniel.cloth.api.datagen.v1.DataGeneratorHandler; +import me.shedaniel.cloth.api.datagen.v1.LootTableData; +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 org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.Map; + +public class LootTableDataProvider implements DataProvider, LootTableData { + private static final Logger LOGGER = LogManager.getLogger(); + private final DataGeneratorHandler handler; + private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create(); + public final Table lootTables = HashBasedTable.create(); + + public LootTableDataProvider(DataGeneratorHandler handler) { + this.handler = handler; + this.handler.install(this); + } + + @Override + public void register(LootContextType type, Identifier identifier, LootTable.Builder lootTable) { + this.lootTables.put(type, identifier, lootTable); + } + + @Override + public void run(DataCache cache) throws IOException { + Path path = this.handler.getOutput(); + Map map = Maps.newHashMap(); + lootTables.rowMap().forEach((type, tableMap) -> tableMap.forEach((identifier, builder) -> { + if (map.put(identifier, builder.withType(type).create()) != null) { + throw new IllegalStateException("Duplicate loot table " + identifier); + } + })); + + map.forEach((identifier, lootTable) -> { + Path outputPath = getOutput(path, identifier); + + try { + DataProvider.writeToPath(GSON, cache, LootManager.toJson(lootTable), outputPath); + } catch (IOException var6) { + LOGGER.error("Couldn't save loot table {}", outputPath, var6); + } + }); + } + + private static Path getOutput(Path rootOutput, Identifier lootTableId) { + return rootOutput.resolve("data/" + lootTableId.getNamespace() + "/loot_tables/" + lootTableId.getPath() + ".json"); + } + + @Override + public String getName() { + return getClass().getSimpleName(); + } +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/RecipeDataProvider.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/RecipeDataProvider.java new file mode 100644 index 0000000..246ca71 --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/RecipeDataProvider.java @@ -0,0 +1,84 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.impl.datagen; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import com.google.gson.JsonObject; +import me.shedaniel.cloth.api.datagen.v1.DataGeneratorHandler; +import me.shedaniel.cloth.api.datagen.v1.RecipeData; +import net.minecraft.data.DataCache; +import net.minecraft.data.DataProvider; +import net.minecraft.data.server.RecipesProvider; +import net.minecraft.data.server.recipe.RecipeJsonProvider; +import net.minecraft.util.Identifier; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.Set; + +public class RecipeDataProvider implements DataProvider, RecipeData { + private static final Logger LOGGER = LogManager.getLogger(); + private final DataGeneratorHandler handler; + private final List recipes = Lists.newArrayList(); + + public RecipeDataProvider(DataGeneratorHandler handler) { + this.handler = handler; + this.handler.install(this); + } + + @Override + public void accept(RecipeJsonProvider recipeJsonProvider) { + recipes.add(recipeJsonProvider); + } + + @Override + public void run(DataCache cache) throws IOException { + Path path = this.handler.getOutput(); + Set set = Sets.newHashSet(); + recipes.forEach((recipeJsonProvider) -> { + if (!set.add(recipeJsonProvider.getRecipeId())) { + throw new IllegalStateException("Duplicate recipe " + recipeJsonProvider.getRecipeId()); + } else { + RecipesProvider.saveRecipe(cache, recipeJsonProvider.toJson(), path.resolve("data/" + recipeJsonProvider.getRecipeId().getNamespace() + "/recipes/" + recipeJsonProvider.getRecipeId().getPath() + ".json")); + JsonObject jsonObject = recipeJsonProvider.toAdvancementJson(); + if (jsonObject != null) { + RecipesProvider.saveRecipeAdvancement(cache, jsonObject, path.resolve("data/" + recipeJsonProvider.getRecipeId().getNamespace() + "/advancements/" + recipeJsonProvider.getAdvancementId().getPath() + ".json")); + } + } + }); + } + + @Override + public String getName() { + return getClass().getSimpleName(); + } +} diff --git a/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/TagDataProvider.java b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/TagDataProvider.java new file mode 100644 index 0000000..29ee1ac --- /dev/null +++ b/cloth-datagen-api-v1/src/main/java/me/shedaniel/cloth/impl/datagen/TagDataProvider.java @@ -0,0 +1,216 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + +package me.shedaniel.cloth.impl.datagen; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import me.shedaniel.cloth.api.datagen.v1.DataGeneratorHandler; +import me.shedaniel.cloth.api.datagen.v1.TagData; +import net.minecraft.block.Block; +import net.minecraft.data.DataCache; +import net.minecraft.data.DataProvider; +import net.minecraft.entity.EntityType; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.ItemConvertible; +import net.minecraft.loot.LootTable; +import net.minecraft.tag.Tag; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; +import net.minecraft.util.registry.RegistryKey; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; + +public class TagDataProvider implements DataProvider, TagData { + private static final Logger LOGGER = LogManager.getLogger(); + private final DataGeneratorHandler handler; + private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create(); + private final Table> tagBuilders = HashBasedTable.create(); + + public TagDataProvider(DataGeneratorHandler handler) { + this.handler = handler; + this.handler.install(this); + } + + @Override + public TagBuilder block(Identifier tag) { + Builder builder = tagBuilders.get(TagType.BLOCKS, tag); + if (builder != null) + return builder; + tagBuilders.put(TagType.BLOCKS, tag, new Builder<>(TagType.BLOCKS, tag)); + return block(tag); + } + + @Override + public TagBuilder item(Identifier tag) { + Builder builder = tagBuilders.get(TagType.ITEMS, tag); + if (builder != null) + return builder; + tagBuilders.put(TagType.ITEMS, tag, new Builder<>(TagType.ITEMS, tag)); + return item(tag); + } + + @Override + public TagBuilder> entity(Identifier tag) { + Builder builder = tagBuilders.get(TagType.ENTITY_TYPES, tag); + if (builder != null) + return builder; + tagBuilders.put(TagType.ENTITY_TYPES, tag, new Builder<>(TagType.ENTITY_TYPES, tag)); + return entity(tag); + } + + @Override + public TagBuilder fluid(Identifier tag) { + Builder builder = tagBuilders.get(TagType.FLUIDS, tag); + if (builder != null) + return builder; + tagBuilders.put(TagType.FLUIDS, tag, new Builder<>(TagType.FLUIDS, tag)); + return fluid(tag); + } + + @Override + public void run(DataCache cache) throws IOException { + Map map = Maps.newHashMap(); + + tagBuilders.rowMap().forEach((tagType, tagMap) -> tagMap.forEach((identifier, builder) -> { + JsonObject jsonObject = builder.toJson(); + Path path = this.getOutput(tagType, identifier); + + try { + String string = GSON.toJson(jsonObject); + String string2 = SHA1.hashUnencodedChars(string).toString(); + if (!Objects.equals(cache.getOldSha1(path), string2) || !Files.exists(path)) { + Files.createDirectories(path.getParent()); + BufferedWriter bufferedWriter = Files.newBufferedWriter(path); + Throwable var12 = null; + + try { + bufferedWriter.write(string); + } catch (Throwable var22) { + var12 = var22; + throw var22; + } finally { + if (bufferedWriter != null) { + if (var12 != null) { + try { + bufferedWriter.close(); + } catch (Throwable var21) { + var12.addSuppressed(var21); + } + } else { + bufferedWriter.close(); + } + } + + } + } + + cache.updateSha1(path, string2); + } catch (IOException var24) { + LOGGER.error("Couldn't save tags to {}", path, var24); + } + })); + } + + private Path getOutput(TagType tagType, Identifier identifier) { + return this.handler.getOutput().resolve("data/" + identifier.getNamespace() + "/tags/" + tagType.name().toLowerCase(Locale.ROOT) + "/" + identifier.getPath() + ".json"); + } + + @Override + public String getName() { + return getClass().getSimpleName(); + } + + enum TagType { + BLOCKS(Registry.BLOCK), + ITEMS(Registry.ITEM), + ENTITY_TYPES(Registry.ENTITY_TYPE), + FLUIDS(Registry.FLUID); + + Registry registry; + + TagType(Registry registry) { + this.registry = registry; + } + } + + private static class Builder extends Tag.Builder implements TagBuilder { + private final TagType tagType; + private final Identifier identifier; + + public Builder(TagType tagType, Identifier identifier) { + this.tagType = tagType; + this.identifier = identifier; + } + + @Override + public Identifier getId() { + return identifier; + } + + @Override + public TagBuilder append(Identifier value) { + add(value, "Datagen"); + return this; + } + + @Override + public TagBuilder append(T value) { + Object object = value; + if (value instanceof ItemConvertible && tagType == TagType.ITEMS) + object = ((ItemConvertible) value).asItem(); + return append(((RegistryKey) tagType.registry.getKey(object).get()).getValue()); + } + + @SafeVarargs + @Override + public final TagBuilder append(T... values) { + for (T value : values) { + append(value); + } + return this; + } + + @Override + public TagBuilder appendTag(Identifier tag) { + addTag(tag, "Datagen"); + return this; + } + } +} diff --git a/cloth-datagen-api-v1/src/main/resources/cloth-datagen-api-v1.accessWidener b/cloth-datagen-api-v1/src/main/resources/cloth-datagen-api-v1.accessWidener new file mode 100644 index 0000000..2af0c6d --- /dev/null +++ b/cloth-datagen-api-v1/src/main/resources/cloth-datagen-api-v1.accessWidener @@ -0,0 +1,13 @@ +accessWidener v1 named +accessible field net/minecraft/data/server/BlockLootTableGenerator NEEDS_SILK_TOUCH Lnet/minecraft/loot/condition/LootCondition$Builder; +accessible field net/minecraft/data/server/BlockLootTableGenerator DOESNT_NEED_SILK_TOUCH Lnet/minecraft/loot/condition/LootCondition$Builder; +accessible field net/minecraft/data/server/BlockLootTableGenerator NEEDS_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder; +accessible field net/minecraft/data/server/BlockLootTableGenerator NEEDS_SILK_TOUCH_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder; +accessible field net/minecraft/data/server/BlockLootTableGenerator DOESNT_NEED_SILK_TOUCH_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +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; +accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouch (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator createForBlockNeedingShears (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator createForSlabs (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/RecipesProvider saveRecipe (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V +accessible method net/minecraft/data/server/RecipesProvider saveRecipeAdvancement (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V \ No newline at end of file diff --git a/cloth-datagen-api-v1/src/main/resources/cloth-datagen-api-v1adawd.accessWidener b/cloth-datagen-api-v1/src/main/resources/cloth-datagen-api-v1adawd.accessWidener new file mode 100644 index 0000000..4b1d7f1 --- /dev/null +++ b/cloth-datagen-api-v1/src/main/resources/cloth-datagen-api-v1adawd.accessWidener @@ -0,0 +1,29 @@ +accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouch (Lnet/minecraft/block/Block;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithShears (Lnet/minecraft/block/Block;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouchOrShears (Lnet/minecraft/block/Block;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/LootTableRange;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/LootTableRange;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithSilkTouch (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator pottedPlantDrops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator slabDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +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; +accessible method net/minecraft/data/server/BlockLootTableGenerator nameableContainerDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator shulkerBoxDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator bannerDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator beeNestDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator beehiveDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator oreDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator mushroomBlockDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator grassDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator cropStemDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator attachedCropStemDrops (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithShears (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator leavesDrop (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator oakLeavesDrop (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder; +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; +accessible method net/minecraft/data/server/BlockLootTableGenerator method_30159 (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator method_30158 (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +accessible method net/minecraft/data/server/BlockLootTableGenerator addVinePlantDrop (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V +accessible method net/minecraft/data/server/BlockLootTableGenerator addDrop (Lnet/minecraft/block/Block;Ljava/util/function/Function;)V +accessible method net/minecraft/data/server/BlockLootTableGenerator addDrop (Lnet/minecraft/block/Block;Lnet/minecraft/loot/LootTable$Builder;)V \ No newline at end of file diff --git a/cloth-datagen-api-v1/src/main/resources/fabric.mod.json b/cloth-datagen-api-v1/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..dd38a83 --- /dev/null +++ b/cloth-datagen-api-v1/src/main/resources/fabric.mod.json @@ -0,0 +1,23 @@ +{ + "schemaVersion": 1, + "id": "cloth-datagen-api-v1", + "name": "Cloth Datagen v1", + "description": "API for easier datagens", + "version": "${version}", + "authors": [ + "shedaniel" + ], + "contact": { + "homepage": "https://www.curseforge.com/minecraft/mc-mods/cloth-api", + "sources": "https://github.com/shedaniel/cloth-api", + "issues": "https://github.com/shedaniel/cloth-api/issues" + }, + "license": "Unlicense", + "icon": "icon.png", + "environment": "*", + "accessWidener": "cloth-datagen-api-v1.accessWidener", + "custom": { + "modmenu:api": true, + "modmenu:parent": "cloth-api" + } +} \ No newline at end of file diff --git a/cloth-datagen-api-v1/src/main/resources/icon.png b/cloth-datagen-api-v1/src/main/resources/icon.png new file mode 100644 index 0000000..e69de29 diff --git a/cloth-dynamic-registry-api-v1/src/main/java/me/shedaniel/cloth/api/dynamic/registry/v1/BiomesRegistry.java b/cloth-dynamic-registry-api-v1/src/main/java/me/shedaniel/cloth/api/dynamic/registry/v1/BiomesRegistry.java index 999117b..181c1a4 100644 --- a/cloth-dynamic-registry-api-v1/src/main/java/me/shedaniel/cloth/api/dynamic/registry/v1/BiomesRegistry.java +++ b/cloth-dynamic-registry-api-v1/src/main/java/me/shedaniel/cloth/api/dynamic/registry/v1/BiomesRegistry.java @@ -1,3 +1,30 @@ +/* + * This is free and unencumbered software released into the public domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the benefit + * of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to + */ + package me.shedaniel.cloth.api.dynamic.registry.v1; import com.google.common.collect.ImmutableList; diff --git a/gradle.properties b/gradle.properties index d663e06..0aed0dc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,5 +4,5 @@ minecraft_version=1.16.2 yarn_version=1.16.2+build.1+legacy.20w09a+build.8 fabric_loader_version=0.9.1+build.205 fabric_version=0.17.2+build.396-1.16 -mod_version=1.2.1 +mod_version=1.3.0 cloth_basic_math=0.5.1 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 5da1b5b..4da51b2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,6 +14,7 @@ rootProject.name = 'cloth-api' include 'cloth-armor-api-v1' include 'cloth-client-events-v0' include 'cloth-common-events-v1' +include 'cloth-datagen-api-v1' include 'cloth-durability-bar-api-v1' include 'cloth-dynamic-registry-api-v1' include 'cloth-scissors-api-v1'