generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2eb887
commit 17efc89
Showing
41 changed files
with
267 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
// 1.19.4 2023-06-02T14:03:16.5766506 Caffeinated/Recipes | ||
e2fead7a3c56471229a1547b8af5dacf46dad177 data\caffeinated\advancements\recipes\misc\coffee_beans_from_block.json | ||
e6d3d01f61c3bab9af5118c077b4ffe23002eba2 data\caffeinated\advancements\recipes\misc\java_banner_pattern.json | ||
// 1.20 2023-06-07T12:12:41.4203152 Caffeinated/Recipes | ||
e154bc568fca23d856835d0e300a33c5e3c1fcd5 data\caffeinated\advancements\recipes\misc\coffee_beans_from_block.json | ||
2b1061f72b3e9a1295c9aa4334d37c9dcb3dfc53 data\caffeinated\advancements\recipes\misc\java_banner_pattern.json | ||
76a46edddf4e31119b24a67f63988b18a8aee17f data\caffeinated\recipes\ground_coffee_block.json | ||
78a9786237bb9d4c565d8334b3b7eac772b426a0 data\caffeinated\advancements\recipes\misc\ground_coffee_from_block.json | ||
bc82533d2cadedeb6aec668614fca49614706152 data\caffeinated\advancements\recipes\food\tiramisu.json | ||
187961e40d0322c1b7b655376bfe28d0b99ec8bd data\caffeinated\advancements\recipes\misc\ground_coffee_from_block.json | ||
06c7edbdec5cf1deb92d8e421279587f14aaab54 data\caffeinated\advancements\recipes\food\tiramisu.json | ||
aff0b344beb7238820d9ef40b8eeae0b6ee96bb9 data\caffeinated\recipes\coffee_beans_from_block.json | ||
4c85433379ef206f984248f2181f8f0d58e04302 data\caffeinated\recipes\coffee_beans_from_coffee_berries.json | ||
58eb02ec0ffbfe7e0f4cbca4fd04e5c185e5be5a data\caffeinated\advancements\recipes\misc\coffee_beans_from_coffee_berries.json | ||
6b9902befd959eb3bc01bca55faa32da5902eaeb data\caffeinated\recipes\tiramisu.json | ||
195cc52740e219af6b8b65dde7d9ef8d0768d307 data\caffeinated\advancements\recipes\misc\coffee_beans_from_coffee_berries.json | ||
d34b1b5cba65cbe93df946e3a6badee9edc69dc0 data\caffeinated\recipes\coffee_berries.json | ||
7872d0d8329ad57778754a3bb074ae65f2fe2990 data\caffeinated\recipes\coffee_bean_block.json | ||
743816fab7585e00cd7f2678713589c48bdc2aed data\caffeinated\recipes\ground_coffee_from_block.json | ||
28bd293b0e0326a390dc603edd3a79891263b6bf data\caffeinated\advancements\recipes\building_blocks\ground_coffee_block.json | ||
55a0f263de5782dd9ec9aecd1d1ae815e3760bdb data\caffeinated\advancements\recipes\building_blocks\ground_coffee_block.json | ||
d466ced2e8e679a807bdbcee307e0eb5e6547942 data\caffeinated\recipes\java_banner_pattern.json | ||
2284ca5a752274146a50f5db3365780de0f1602e data\caffeinated\advancements\recipes\building_blocks\coffee_bean_block.json | ||
bb529f25b75b190a9da8518d7a0931d22cbaf194 data\caffeinated\advancements\recipes\building_blocks\coffee_bean_block.json | ||
9d1c02e4b749346060e0aca83030e22690aed245 data\caffeinated\recipes\ground_coffee_from_coffee_beans.json | ||
20ced6cf1d619bb41bf6e331479442b649420283 data\caffeinated\advancements\recipes\misc\ground_coffee_from_coffee_beans.json | ||
687a2ea285584ee9d8f878bfebb8ac275be71986 data\caffeinated\advancements\recipes\food\coffee_berries.json | ||
c25fb492ba07b4ed02e133e2329fe9f0b00a2b5e data\caffeinated\advancements\recipes\misc\ground_coffee_from_coffee_beans.json | ||
7ac9428c1c4810e6e439997467b8c5afad1711b9 data\caffeinated\advancements\recipes\food\coffee_berries.json |
2 changes: 1 addition & 1 deletion
2
src/main/generated/.cache/f97ece2f3a543d4dbc8c984a7bcdf2d64b8f7bed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:coffee_bean_block" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:ground_coffee_block" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:coffee_berries" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:tiramisu" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:coffee_beans_from_block" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:coffee_beans_from_coffee_berries" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:ground_coffee_from_block" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:ground_coffee_from_coffee_beans" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,5 +30,6 @@ | |
"recipes": [ | ||
"caffeinated:java_banner_pattern" | ||
] | ||
} | ||
}, | ||
"sends_telemetry_event": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
src/main/java/com/chikoritalover/caffeinated/CaffeinatedDataGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package com.chikoritalover.caffeinated; | ||
|
||
import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks; | ||
import com.chikoritalover.caffeinated.registry.CaffeinatedItems; | ||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; | ||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; | ||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; | ||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; | ||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.LeveledCauldronBlock; | ||
import net.minecraft.data.client.*; | ||
import net.minecraft.data.server.recipe.RecipeJsonProvider; | ||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; | ||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; | ||
import net.minecraft.item.ItemConvertible; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.recipe.book.RecipeCategory; | ||
import net.minecraft.state.property.Properties; | ||
import net.minecraft.state.property.Property; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public class CaffeinatedDataGenerator implements DataGeneratorEntrypoint { | ||
@Override | ||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { | ||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); | ||
pack.addProvider(CaffeinatedModelGenerator::new); | ||
pack.addProvider(CaffeinatedRecipeGenerator::new); | ||
} | ||
|
||
private static class CaffeinatedModelGenerator extends FabricModelProvider { | ||
private CaffeinatedModelGenerator(FabricDataOutput output) { | ||
super(output); | ||
} | ||
|
||
public final void registerCoffeeShrub(BlockStateModelGenerator blockStateModelGenerator, Block crop, Block pottedCrop, Property<Integer> ageProperty, int... ageTextureIndices) { | ||
if (ageProperty.getValues().size() != ageTextureIndices.length) { | ||
throw new IllegalArgumentException(); | ||
} else { | ||
Int2ObjectMap<Identifier> int2ObjectMap = new Int2ObjectOpenHashMap<>(); | ||
BlockStateVariantMap blockStateVariantMap = BlockStateVariantMap.create(ageProperty).register((integer) -> { | ||
int i = ageTextureIndices[integer]; | ||
Identifier identifier = int2ObjectMap.computeIfAbsent(i, (j) -> blockStateModelGenerator.createSubModel(crop, "_stage" + i, Models.CROSS, TextureMap::cross)); | ||
return BlockStateVariant.create().put(VariantSettings.MODEL, identifier); | ||
}); | ||
blockStateModelGenerator.registerItemModel(crop.asItem()); | ||
blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(crop).coordinate(blockStateVariantMap)); | ||
} | ||
|
||
TextureMap textureMap = TextureMap.plant(TextureMap.getSubId(crop, "_stage1")); | ||
Identifier identifier = BlockStateModelGenerator.TintType.NOT_TINTED.getFlowerPotCrossModel().upload(pottedCrop, textureMap, blockStateModelGenerator.modelCollector); | ||
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(pottedCrop, identifier)); | ||
} | ||
|
||
@Override | ||
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { | ||
blockStateModelGenerator.registerSimpleCubeAll(CaffeinatedBlocks.COFFEE_BEAN_BLOCK); | ||
blockStateModelGenerator.registerSimpleCubeAll(CaffeinatedBlocks.GROUND_COFFEE_BLOCK); | ||
blockStateModelGenerator.registerSingleton(CaffeinatedBlocks.COFFEE_BERRY_CRATE, new TextureMap().put(TextureKey.SIDE, new Identifier(Caffeinated.MODID, "block/coffee_berry_crate_side")).put(TextureKey.TOP, new Identifier(Caffeinated.MODID, "block/coffee_berry_crate_top")).put(TextureKey.BOTTOM, new Identifier("farmersdelight", "block/crate_bottom")), Models.CUBE_BOTTOM_TOP); | ||
|
||
blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(CaffeinatedBlocks.COFFEE_CAULDRON).coordinate(BlockStateVariantMap.create(LeveledCauldronBlock.LEVEL).register(1, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL1.upload(CaffeinatedBlocks.COFFEE_CAULDRON, "_level1", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector))).register(2, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL2.upload(CaffeinatedBlocks.COFFEE_CAULDRON, "_level2", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector))).register(3, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_FULL.upload(CaffeinatedBlocks.COFFEE_CAULDRON, "_full", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector))))); | ||
|
||
blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON).coordinate(BlockStateVariantMap.create(LeveledCauldronBlock.LEVEL).register(1, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL1.upload(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, "_level1", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector))).register(2, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL2.upload(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, "_level2", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector))).register(3, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_FULL.upload(CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, "_full", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector))))); | ||
|
||
registerCoffeeShrub(blockStateModelGenerator, CaffeinatedBlocks.COFFEE_SHRUB, CaffeinatedBlocks.POTTED_COFFEE_SHRUB, Properties.AGE_3, 0, 0, 1, 1); | ||
} | ||
|
||
@Override | ||
public void generateItemModels(ItemModelGenerator itemModelGenerator) { | ||
itemModelGenerator.register(CaffeinatedItems.GROUND_COFFEE, Models.GENERATED); | ||
itemModelGenerator.register(CaffeinatedItems.JAVA_BANNER_PATTERN, Models.GENERATED); | ||
|
||
itemModelGenerator.register(CaffeinatedItems.COFFEE_BERRIES, Models.GENERATED); | ||
itemModelGenerator.register(CaffeinatedItems.COFFEE_BOTTLE, Models.GENERATED); | ||
itemModelGenerator.register(CaffeinatedItems.TIRAMISU, Models.GENERATED); | ||
} | ||
} | ||
|
||
private static class CaffeinatedRecipeGenerator extends FabricRecipeProvider { | ||
private CaffeinatedRecipeGenerator(FabricDataOutput output) { | ||
super(output); | ||
} | ||
|
||
public static void offerReversibleCompactingRecipes(Consumer<RecipeJsonProvider> exporter, ItemConvertible input, ItemConvertible compacted, String compactingRecipeName, @Nullable String compactingRecipeGroup, String reverseRecipeName, @Nullable String reverseRecipeGroup) { | ||
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, input, 9).input(compacted).group(reverseRecipeGroup).criterion(hasItem(compacted), conditionsFromItem(compacted)).offerTo(exporter, new Identifier(Caffeinated.MODID, reverseRecipeName)); | ||
ShapedRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, compacted).input('#', input).pattern("###").pattern("###").pattern("###").group(compactingRecipeGroup).criterion(hasItem(input), conditionsFromItem(input)).offerTo(exporter, new Identifier(Caffeinated.MODID, compactingRecipeName)); | ||
} | ||
|
||
@Override | ||
public void generate(Consumer<RecipeJsonProvider> exporter) { | ||
offerReversibleCompactingRecipes(exporter, CaffeinatedItems.COFFEE_BEANS, CaffeinatedBlocks.COFFEE_BEAN_BLOCK, "coffee_bean_block", null, "coffee_beans_from_block", "coffee_beans"); | ||
|
||
offerReversibleCompactingRecipes(exporter, CaffeinatedItems.GROUND_COFFEE, CaffeinatedBlocks.GROUND_COFFEE_BLOCK, "ground_coffee_block", null, "ground_coffee_from_block", "ground_coffee"); | ||
|
||
ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedItems.COFFEE_BERRIES, 9).input(CaffeinatedBlocks.COFFEE_BERRY_CRATE).criterion(hasItem(CaffeinatedBlocks.COFFEE_BERRY_CRATE), conditionsFromItem(CaffeinatedBlocks.COFFEE_BERRY_CRATE)).offerTo(exporter); | ||
|
||
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, CaffeinatedItems.COFFEE_BEANS).input(CaffeinatedItems.COFFEE_BERRIES).group("coffee_beans").criterion(hasItem(CaffeinatedItems.COFFEE_BERRIES), conditionsFromItem(CaffeinatedItems.COFFEE_BERRIES)).offerTo(exporter, new Identifier(Caffeinated.MODID, "coffee_beans_from_coffee_berries")); | ||
|
||
ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, CaffeinatedItems.GROUND_COFFEE).input('#', CaffeinatedItems.COFFEE_BEANS).pattern("###").group("ground_coffee").criterion(hasItem(CaffeinatedItems.COFFEE_BEANS), conditionsFromItem(CaffeinatedItems.COFFEE_BEANS)).offerTo(exporter, new Identifier(Caffeinated.MODID, "ground_coffee_from_coffee_beans")); | ||
|
||
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, CaffeinatedItems.JAVA_BANNER_PATTERN).input(Items.PAPER).input(CaffeinatedItems.COFFEE_BOTTLE).criterion(hasItem(CaffeinatedItems.COFFEE_BOTTLE), conditionsFromItem(CaffeinatedItems.COFFEE_BOTTLE)).offerTo(exporter); | ||
|
||
ShapedRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedItems.TIRAMISU, 2).input('#', CaffeinatedItems.COFFEE_BOTTLE).input('C', Items.COCOA_BEANS).input('E', Items.EGG).input('M', Items.MILK_BUCKET).input('W', Items.WHEAT).pattern("C#C").pattern("EME").pattern("WWW").group("tiramisu").criterion(hasItem(CaffeinatedItems.COFFEE_BOTTLE), conditionsFromItem(CaffeinatedItems.COFFEE_BOTTLE)).offerTo(exporter); | ||
} | ||
} | ||
} |
Oops, something went wrong.