diff --git a/gradle.properties b/gradle.properties index f53ceb1..f912521 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true # Fabric Properties - # check these on https://fabricmc.net/develop - minecraft_version=1.19.4 - yarn_mappings=1.19.4+build.2 +# check these on https://fabricmc.net/develop + minecraft_version=1.20 + yarn_mappings=1.20+build.1 loader_version=0.14.21 # Mod Properties @@ -15,5 +15,5 @@ org.gradle.parallel=true archives_base_name = caffeinated # Dependencies - fabric_version=0.83.0+1.19.4 + fabric_version=0.83.0+1.20 farmersdelight_version=4111426 diff --git a/src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc b/src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc index 4bb4eff..c3d373d 100644 --- a/src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc +++ b/src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc @@ -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 diff --git a/src/main/generated/.cache/f97ece2f3a543d4dbc8c984a7bcdf2d64b8f7bed b/src/main/generated/.cache/f97ece2f3a543d4dbc8c984a7bcdf2d64b8f7bed index ef8e85a..b2ddf68 100644 --- a/src/main/generated/.cache/f97ece2f3a543d4dbc8c984a7bcdf2d64b8f7bed +++ b/src/main/generated/.cache/f97ece2f3a543d4dbc8c984a7bcdf2d64b8f7bed @@ -1,4 +1,4 @@ -// 1.19.4 2023-06-02T14:03:16.5627356 Caffeinated/Model Definitions +// 1.20 2023-06-07T12:12:41.4182846 Caffeinated/Model Definitions da4528a3cfafc1ab21e5814b64029c10ec357178 assets\caffeinated\blockstates\ground_coffee_block.json 26f35f3a03b0d53578efd2c555721b08353d75f0 assets\caffeinated\blockstates\coffee_cauldron.json b1a481861132973fe035c9b9ce7613e15938034c assets\caffeinated\models\block\coffee_berry_crate.json diff --git a/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/coffee_bean_block.json b/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/coffee_bean_block.json index ebc9f9d..e8ffe36 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/coffee_bean_block.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/coffee_bean_block.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:coffee_bean_block" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/ground_coffee_block.json b/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/ground_coffee_block.json index c3cee07..7b40a74 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/ground_coffee_block.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/building_blocks/ground_coffee_block.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:ground_coffee_block" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/food/coffee_berries.json b/src/main/generated/data/caffeinated/advancements/recipes/food/coffee_berries.json index 42b4317..8ae15c9 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/food/coffee_berries.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/food/coffee_berries.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:coffee_berries" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/food/tiramisu.json b/src/main/generated/data/caffeinated/advancements/recipes/food/tiramisu.json index a812d21..c8d69dc 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/food/tiramisu.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/food/tiramisu.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:tiramisu" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_block.json b/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_block.json index af67ed5..ab351ad 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_block.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_block.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:coffee_beans_from_block" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_coffee_berries.json b/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_coffee_berries.json index 12ccea6..8fb4579 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_coffee_berries.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/misc/coffee_beans_from_coffee_berries.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:coffee_beans_from_coffee_berries" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_block.json b/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_block.json index d6123dc..68621e9 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_block.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_block.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:ground_coffee_from_block" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_coffee_beans.json b/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_coffee_beans.json index 671e27e..64ac49e 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_coffee_beans.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/misc/ground_coffee_from_coffee_beans.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:ground_coffee_from_coffee_beans" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/generated/data/caffeinated/advancements/recipes/misc/java_banner_pattern.json b/src/main/generated/data/caffeinated/advancements/recipes/misc/java_banner_pattern.json index 6e5169b..890ed4c 100644 --- a/src/main/generated/data/caffeinated/advancements/recipes/misc/java_banner_pattern.json +++ b/src/main/generated/data/caffeinated/advancements/recipes/misc/java_banner_pattern.json @@ -30,5 +30,6 @@ "recipes": [ "caffeinated:java_banner_pattern" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/main/java/com/chikoritalover/caffeinated/Caffeinated.java b/src/main/java/com/chikoritalover/caffeinated/Caffeinated.java index ae34896..fd1a9d1 100644 --- a/src/main/java/com/chikoritalover/caffeinated/Caffeinated.java +++ b/src/main/java/com/chikoritalover/caffeinated/Caffeinated.java @@ -24,28 +24,28 @@ public class Caffeinated implements ModInitializer { @Override public void onInitialize() { - ModBannerPatterns.initAndGetDefault(Registries.BANNER_PATTERN); - ModBlocks.register(); - ModCauldronBehavior.register(); - ModItems.register(); - ModParticleTypes.register(); - ModPlacedFeatures.register(); - ModSoundEvents.register(); - ModStats.register(); - ModStatusEffects.register(); - ModTradeOffers.register(); - ModBlockSoundGroup.register(); - ModEntityTypeTags.register(); - ModBlockTags.register(); - ModItemTags.register(); - ModBannerPatternTags.register(); - ModBannerPatterns.register(); + CaffeinatedBannerPatterns.initAndGetDefault(Registries.BANNER_PATTERN); + CaffeinatedBlocks.register(); + CaffeinatedCauldronBehavior.register(); + CaffeinatedItems.register(); + CaffeinatedParticleTypes.register(); + CaffeinatedPlacedFeatures.register(); + CaffeinatedSoundEvents.register(); + CaffeinatedStats.register(); + CaffeinatedStatusEffects.register(); + CaffeinatedTradeOffers.register(); + CaffeinatedBlockSoundGroup.register(); + CaffeinatedEntityTypeTags.register(); + CaffeinatedBlockTags.register(); + CaffeinatedItemTags.register(); + CaffeinatedBannerPatternTags.register(); + CaffeinatedBannerPatterns.register(); registerLootTableEvents(); } public void registerLootTableEvents() { - addLootTablePool(1, 1, 0.5F, LootTables.JUNGLE_TEMPLE_CHEST, ModItems.COFFEE_BEANS, 1, 3); + addLootTablePool(1, 1, 0.5F, LootTables.JUNGLE_TEMPLE_CHEST, CaffeinatedItems.COFFEE_BEANS, 1, 3); } private void addLootTablePool(int minRolls, int maxRolls, float chance, Identifier lootTable, ItemConvertible item) { diff --git a/src/main/java/com/chikoritalover/caffeinated/CaffeinatedClient.java b/src/main/java/com/chikoritalover/caffeinated/CaffeinatedClient.java index a19973b..a20c0fd 100644 --- a/src/main/java/com/chikoritalover/caffeinated/CaffeinatedClient.java +++ b/src/main/java/com/chikoritalover/caffeinated/CaffeinatedClient.java @@ -1,7 +1,7 @@ package com.chikoritalover.caffeinated; -import com.chikoritalover.caffeinated.registry.ModBlocks; -import com.chikoritalover.caffeinated.registry.ModParticleTypes; +import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks; +import com.chikoritalover.caffeinated.registry.CaffeinatedParticleTypes; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; @@ -11,10 +11,10 @@ public class CaffeinatedClient implements ClientModInitializer { @Override public void onInitializeClient() { - BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.COFFEE_SHRUB, RenderLayer.getCutout()); - BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.FLOWERING_COFFEE_SHRUB, RenderLayer.getCutout()); - BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.POTTED_COFFEE_SHRUB, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.COFFEE_SHRUB, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.FLOWERING_COFFEE_SHRUB, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.POTTED_COFFEE_SHRUB, RenderLayer.getCutout()); - ParticleFactoryRegistry.getInstance().register(ModParticleTypes.COFFEE_POP, BubblePopParticle.Factory::new); + ParticleFactoryRegistry.getInstance().register(CaffeinatedParticleTypes.COFFEE_POP, BubblePopParticle.Factory::new); } } diff --git a/src/main/java/com/chikoritalover/caffeinated/CaffeinatedDataGenerator.java b/src/main/java/com/chikoritalover/caffeinated/CaffeinatedDataGenerator.java new file mode 100644 index 0000000..1ffe6cb --- /dev/null +++ b/src/main/java/com/chikoritalover/caffeinated/CaffeinatedDataGenerator.java @@ -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 ageProperty, int... ageTextureIndices) { + if (ageProperty.getValues().size() != ageTextureIndices.length) { + throw new IllegalArgumentException(); + } else { + Int2ObjectMap 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 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 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); + } + } +} diff --git a/src/main/java/com/chikoritalover/caffeinated/CaffeinatedDatagen.java b/src/main/java/com/chikoritalover/caffeinated/CaffeinatedDatagen.java deleted file mode 100644 index d424b80..0000000 --- a/src/main/java/com/chikoritalover/caffeinated/CaffeinatedDatagen.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.chikoritalover.caffeinated; - -import com.chikoritalover.caffeinated.registry.ModBlocks; -import com.chikoritalover.caffeinated.registry.ModItems; -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 CaffeinatedDatagen 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 ageProperty, int... ageTextureIndices) { - if (ageProperty.getValues().size() != ageTextureIndices.length) { - throw new IllegalArgumentException(); - } else { - Int2ObjectMap 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(ModBlocks.COFFEE_BEAN_BLOCK); - blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.GROUND_COFFEE_BLOCK); - blockStateModelGenerator.registerSingleton(ModBlocks.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(ModBlocks.COFFEE_CAULDRON).coordinate(BlockStateVariantMap.create(LeveledCauldronBlock.LEVEL).register(1, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL1.upload(ModBlocks.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(ModBlocks.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(ModBlocks.COFFEE_CAULDRON, "_full", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/coffee")), blockStateModelGenerator.modelCollector))))); - - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(ModBlocks.GROUND_COFFEE_CAULDRON).coordinate(BlockStateVariantMap.create(LeveledCauldronBlock.LEVEL).register(1, BlockStateVariant.create().put(VariantSettings.MODEL, Models.TEMPLATE_CAULDRON_LEVEL1.upload(ModBlocks.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(ModBlocks.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(ModBlocks.GROUND_COFFEE_CAULDRON, "_full", TextureMap.cauldron(new Identifier(Caffeinated.MODID, "block/ground_coffee_cauldron")), blockStateModelGenerator.modelCollector))))); - - registerCoffeeShrub(blockStateModelGenerator, ModBlocks.COFFEE_SHRUB, ModBlocks.POTTED_COFFEE_SHRUB, Properties.AGE_3, 0, 0, 1, 1); - } - - @Override - public void generateItemModels(ItemModelGenerator itemModelGenerator) { - itemModelGenerator.register(ModItems.GROUND_COFFEE, Models.GENERATED); - itemModelGenerator.register(ModItems.JAVA_BANNER_PATTERN, Models.GENERATED); - - itemModelGenerator.register(ModItems.COFFEE_BERRIES, Models.GENERATED); - itemModelGenerator.register(ModItems.COFFEE_BOTTLE, Models.GENERATED); - itemModelGenerator.register(ModItems.TIRAMISU, Models.GENERATED); - } - } - - private static class CaffeinatedRecipeGenerator extends FabricRecipeProvider { - private CaffeinatedRecipeGenerator(FabricDataOutput output) { - super(output); - } - - public static void offerReversibleCompactingRecipes(Consumer 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 exporter) { - offerReversibleCompactingRecipes(exporter, ModItems.COFFEE_BEANS, ModBlocks.COFFEE_BEAN_BLOCK, "coffee_bean_block", null, "coffee_beans_from_block", "coffee_beans"); - - offerReversibleCompactingRecipes(exporter, ModItems.GROUND_COFFEE, ModBlocks.GROUND_COFFEE_BLOCK, "ground_coffee_block", null, "ground_coffee_from_block", "ground_coffee"); - - ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, ModItems.COFFEE_BERRIES, 9).input(ModBlocks.COFFEE_BERRY_CRATE).criterion(hasItem(ModBlocks.COFFEE_BERRY_CRATE), conditionsFromItem(ModBlocks.COFFEE_BERRY_CRATE)).offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, ModItems.COFFEE_BEANS).input(ModItems.COFFEE_BERRIES).group("coffee_beans").criterion(hasItem(ModItems.COFFEE_BERRIES), conditionsFromItem(ModItems.COFFEE_BERRIES)).offerTo(exporter, new Identifier(Caffeinated.MODID, "coffee_beans_from_coffee_berries")); - - ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, ModItems.GROUND_COFFEE).input('#', ModItems.COFFEE_BEANS).pattern("###").group("ground_coffee").criterion(hasItem(ModItems.COFFEE_BEANS), conditionsFromItem(ModItems.COFFEE_BEANS)).offerTo(exporter, new Identifier(Caffeinated.MODID, "ground_coffee_from_coffee_beans")); - - ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, ModItems.JAVA_BANNER_PATTERN).input(Items.PAPER).input(ModItems.COFFEE_BOTTLE).criterion(hasItem(ModItems.COFFEE_BOTTLE), conditionsFromItem(ModItems.COFFEE_BOTTLE)).offerTo(exporter); - - ShapedRecipeJsonBuilder.create(RecipeCategory.FOOD, ModItems.TIRAMISU, 2).input('#', ModItems.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(ModItems.COFFEE_BOTTLE), conditionsFromItem(ModItems.COFFEE_BOTTLE)).offerTo(exporter); - } - } -} diff --git a/src/main/java/com/chikoritalover/caffeinated/block/CoffeeCauldronBlock.java b/src/main/java/com/chikoritalover/caffeinated/block/CoffeeCauldronBlock.java index 0b1ad03..f593976 100644 --- a/src/main/java/com/chikoritalover/caffeinated/block/CoffeeCauldronBlock.java +++ b/src/main/java/com/chikoritalover/caffeinated/block/CoffeeCauldronBlock.java @@ -1,8 +1,8 @@ package com.chikoritalover.caffeinated.block; -import com.chikoritalover.caffeinated.registry.ModBlockTags; -import com.chikoritalover.caffeinated.registry.ModParticleTypes; -import com.chikoritalover.caffeinated.registry.ModSoundEvents; +import com.chikoritalover.caffeinated.registry.CaffeinatedBlockTags; +import com.chikoritalover.caffeinated.registry.CaffeinatedParticleTypes; +import com.chikoritalover.caffeinated.registry.CaffeinatedSoundEvents; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -34,7 +34,7 @@ public static boolean isLitFireInRange(World world, BlockPos pos) { BlockPos blockPos = pos.down(); BlockState blockState = world.getBlockState(blockPos); - boolean bl = blockState.isIn(ModBlockTags.LIT_FIRES); + boolean bl = blockState.isIn(CaffeinatedBlockTags.LIT_FIRES); if (blockState.contains(Properties.LIT)) { return bl && blockState.get(Properties.LIT); @@ -44,7 +44,7 @@ public static boolean isLitFireInRange(World world, BlockPos pos) { } public ParticleEffect getPopParticleEffect() { - return ModParticleTypes.COFFEE_POP; + return CaffeinatedParticleTypes.COFFEE_POP; } public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { @@ -59,7 +59,7 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando double e = pos.getY() + 0.375 + level * 0.1875; double f = pos.getZ() + random.nextDouble() * 0.5 + 0.25; if (random.nextDouble() < 0.15) { - world.playSound(d, e, f, ModSoundEvents.BLOCK_CAULDRON_BUBBLE, SoundCategory.BLOCKS, 0.2F, 2.5F - level * 0.5F, true); + world.playSound(d, e, f, CaffeinatedSoundEvents.BLOCK_CAULDRON_BUBBLE, SoundCategory.BLOCKS, 0.2F, 2.5F - level * 0.5F, true); } world.addParticle(getPopParticleEffect(), d, e, f, 0.0, 0.0, 0.0); diff --git a/src/main/java/com/chikoritalover/caffeinated/block/CoffeeShrubBlock.java b/src/main/java/com/chikoritalover/caffeinated/block/CoffeeShrubBlock.java index 76e1ea1..af152c3 100644 --- a/src/main/java/com/chikoritalover/caffeinated/block/CoffeeShrubBlock.java +++ b/src/main/java/com/chikoritalover/caffeinated/block/CoffeeShrubBlock.java @@ -1,7 +1,7 @@ package com.chikoritalover.caffeinated.block; -import com.chikoritalover.caffeinated.registry.ModBlocks; -import com.chikoritalover.caffeinated.registry.ModItems; +import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks; +import com.chikoritalover.caffeinated.registry.CaffeinatedItems; import net.minecraft.block.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -32,7 +32,7 @@ public CoffeeShrubBlock(AbstractBlock.Settings settings) { } public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { - return new ItemStack(ModItems.COFFEE_BEANS); + return new ItemStack(CaffeinatedItems.COFFEE_BEANS); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { @@ -46,7 +46,7 @@ public boolean hasRandomTicks(BlockState state) { public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { int i = state.get(AGE); BlockState aboveState = world.getBlockState(pos.up()); - if ((i < 3 || aboveState.getMaterial().isReplaceable()) && random.nextInt(5) == 0 && world.getBaseLightLevel(pos.up(), 0) >= 9) { + if ((i < 3 || aboveState.isReplaceable()) && random.nextInt(5) == 0 && world.getBaseLightLevel(pos.up(), 0) >= 9) { grow(world, random, pos, state); BlockState state2 = world.getBlockState(pos); world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(state2)); @@ -57,7 +57,7 @@ public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { int i = state.get(AGE); BlockState aboveState = world.getBlockState(pos.up()); - boolean bl = i == 3 && !aboveState.getMaterial().isReplaceable(); + boolean bl = i == 3 && !aboveState.isReplaceable(); if (!bl && player.getStackInHand(hand).isOf(Items.BONE_MEAL)) { return ActionResult.PASS; } else { @@ -72,7 +72,7 @@ protected void appendProperties(StateManager.Builder builder) public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { int i = state.get(AGE); BlockState aboveState = world.getBlockState(pos.up()); - return i < 3 || aboveState.getMaterial().isReplaceable(); + return i < 3 || aboveState.isReplaceable(); } public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { @@ -80,7 +80,7 @@ public boolean canGrow(World world, Random random, BlockPos pos, BlockState stat } public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { - BlockState state2 = state.get(AGE) < 3 ? state.cycle(AGE) : ModBlocks.FLOWERING_COFFEE_SHRUB.getDefaultState(); + BlockState state2 = state.get(AGE) < 3 ? state.cycle(AGE) : CaffeinatedBlocks.FLOWERING_COFFEE_SHRUB.getDefaultState(); world.setBlockState(pos, state2, 2); if (state.get(AGE) == 3) { world.setBlockState(pos.up(), state2.cycle(Properties.DOUBLE_BLOCK_HALF), 2); diff --git a/src/main/java/com/chikoritalover/caffeinated/block/FloweringCoffeeShrubBlock.java b/src/main/java/com/chikoritalover/caffeinated/block/FloweringCoffeeShrubBlock.java index 4ba12fe..a55b893 100644 --- a/src/main/java/com/chikoritalover/caffeinated/block/FloweringCoffeeShrubBlock.java +++ b/src/main/java/com/chikoritalover/caffeinated/block/FloweringCoffeeShrubBlock.java @@ -1,7 +1,7 @@ package com.chikoritalover.caffeinated.block; -import com.chikoritalover.caffeinated.registry.ModItems; -import com.chikoritalover.caffeinated.registry.ModSoundEvents; +import com.chikoritalover.caffeinated.registry.CaffeinatedItems; +import com.chikoritalover.caffeinated.registry.CaffeinatedSoundEvents; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Fertilizable; @@ -33,7 +33,7 @@ public FloweringCoffeeShrubBlock(Settings settings) { } public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { - return new ItemStack(ModItems.COFFEE_BEANS); + return new ItemStack(CaffeinatedItems.COFFEE_BEANS); } public boolean hasRandomTicks(BlockState state) { @@ -65,8 +65,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt return ActionResult.PASS; } else if (i == 3) { int j = 1 + world.random.nextInt(2); - dropStack(world, pos, new ItemStack(ModItems.COFFEE_BERRIES, j + (bl ? 1 : 0))); - world.playSound(null, pos, ModSoundEvents.BLOCK_COFFEE_SHRUB_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F); + dropStack(world, pos, new ItemStack(CaffeinatedItems.COFFEE_BERRIES, j + (bl ? 1 : 0))); + world.playSound(null, pos, CaffeinatedSoundEvents.BLOCK_COFFEE_SHRUB_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F); BlockState blockState = state.with(AGE, 0); world.setBlockState(pos, blockState, 2); diff --git a/src/main/java/com/chikoritalover/caffeinated/block/GroundCoffeeCauldronBlock.java b/src/main/java/com/chikoritalover/caffeinated/block/GroundCoffeeCauldronBlock.java index 0393b21..e24c1b6 100644 --- a/src/main/java/com/chikoritalover/caffeinated/block/GroundCoffeeCauldronBlock.java +++ b/src/main/java/com/chikoritalover/caffeinated/block/GroundCoffeeCauldronBlock.java @@ -1,8 +1,8 @@ package com.chikoritalover.caffeinated.block; -import com.chikoritalover.caffeinated.registry.ModBlocks; -import com.chikoritalover.caffeinated.registry.ModCauldronBehavior; -import com.chikoritalover.caffeinated.registry.ModSoundEvents; +import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks; +import com.chikoritalover.caffeinated.registry.CaffeinatedCauldronBehavior; +import com.chikoritalover.caffeinated.registry.CaffeinatedSoundEvents; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.particle.ParticleEffect; @@ -16,7 +16,7 @@ public class GroundCoffeeCauldronBlock extends CoffeeCauldronBlock { public GroundCoffeeCauldronBlock(Settings settings) { - super(settings, ModCauldronBehavior.GROUND_COFFEE_CAULDRON_BEHAVIOR); + super(settings, CaffeinatedCauldronBehavior.GROUND_COFFEE_CAULDRON_BEHAVIOR); } @Override @@ -27,25 +27,25 @@ public ParticleEffect getPopParticleEffect() { @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if (isLitFireInRange(world, pos)) { - world.scheduleBlockTick(pos, ModBlocks.GROUND_COFFEE_CAULDRON, 200); + world.scheduleBlockTick(pos, CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, 200); } } public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { if (isLitFireInRange(world, pos)) { - world.scheduleBlockTick(pos, ModBlocks.GROUND_COFFEE_CAULDRON, 200); + world.scheduleBlockTick(pos, CaffeinatedBlocks.GROUND_COFFEE_CAULDRON, 200); } } @Override public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { if (isLitFireInRange(world, pos)) { - BlockState blockState = ModBlocks.COFFEE_CAULDRON.getDefaultState().with(LEVEL, state.get(LEVEL)).with(CoffeeCauldronBlock.REWARD_EXPERIENCE, true); + BlockState blockState = CaffeinatedBlocks.COFFEE_CAULDRON.getDefaultState().with(LEVEL, state.get(LEVEL)).with(CoffeeCauldronBlock.REWARD_EXPERIENCE, true); world.setBlockState(pos, blockState); world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(blockState)); - world.playSound(null, pos, ModSoundEvents.BLOCK_CAULDRON_BREW, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, CaffeinatedSoundEvents.BLOCK_CAULDRON_BREW, SoundCategory.BLOCKS, 1.0F, 1.0F); } } } diff --git a/src/main/java/com/chikoritalover/caffeinated/item/CoffeeBottleItem.java b/src/main/java/com/chikoritalover/caffeinated/item/CoffeeBottleItem.java index 9299034..f0ed15a 100644 --- a/src/main/java/com/chikoritalover/caffeinated/item/CoffeeBottleItem.java +++ b/src/main/java/com/chikoritalover/caffeinated/item/CoffeeBottleItem.java @@ -1,6 +1,6 @@ package com.chikoritalover.caffeinated.item; -import com.chikoritalover.caffeinated.registry.ModSoundEvents; +import com.chikoritalover.caffeinated.registry.CaffeinatedSoundEvents; import net.minecraft.advancement.criterion.Criteria; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffects; @@ -59,11 +59,11 @@ public UseAction getUseAction(ItemStack stack) { } public SoundEvent getDrinkSound() { - return ModSoundEvents.ITEM_COFFEE_BOTTLE_DRINK; + return CaffeinatedSoundEvents.ITEM_COFFEE_BOTTLE_DRINK; } public SoundEvent getEatSound() { - return ModSoundEvents.ITEM_COFFEE_BOTTLE_DRINK; + return CaffeinatedSoundEvents.ITEM_COFFEE_BOTTLE_DRINK; } public TypedActionResult use(World world, PlayerEntity user, Hand hand) { diff --git a/src/main/java/com/chikoritalover/caffeinated/mixin/GrowCropsGoalMixin.java b/src/main/java/com/chikoritalover/caffeinated/mixin/GrowCropsGoalMixin.java index 18b324c..ec0bf8d 100644 --- a/src/main/java/com/chikoritalover/caffeinated/mixin/GrowCropsGoalMixin.java +++ b/src/main/java/com/chikoritalover/caffeinated/mixin/GrowCropsGoalMixin.java @@ -2,7 +2,7 @@ import com.chikoritalover.caffeinated.block.CoffeeShrubBlock; import com.chikoritalover.caffeinated.block.FloweringCoffeeShrubBlock; -import com.chikoritalover.caffeinated.registry.ModBlocks; +import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.enums.DoubleBlockHalf; @@ -29,10 +29,10 @@ public void tick(CallbackInfo info, int i, BlockPos blockPos, BlockState blockSt bl = true; if (blockState.get(CoffeeShrubBlock.AGE) == 3) { - field_20373.world.setBlockState(blockPos, ModBlocks.FLOWERING_COFFEE_SHRUB.getDefaultState()); - field_20373.world.setBlockState(blockPos.up(), ModBlocks.FLOWERING_COFFEE_SHRUB.getDefaultState().cycle(FloweringCoffeeShrubBlock.HALF)); + field_20373.getWorld().setBlockState(blockPos, CaffeinatedBlocks.FLOWERING_COFFEE_SHRUB.getDefaultState()); + field_20373.getWorld().setBlockState(blockPos.up(), CaffeinatedBlocks.FLOWERING_COFFEE_SHRUB.getDefaultState().cycle(FloweringCoffeeShrubBlock.HALF)); } else { - field_20373.world.setBlockState(blockPos, blockState.cycle(CoffeeShrubBlock.AGE)); + field_20373.getWorld().setBlockState(blockPos, blockState.cycle(CoffeeShrubBlock.AGE)); } } else if (block instanceof FloweringCoffeeShrubBlock) { if (blockState.get(FloweringCoffeeShrubBlock.AGE) < 3) { @@ -41,13 +41,13 @@ public void tick(CallbackInfo info, int i, BlockPos blockPos, BlockState blockSt BlockState blockState2 = blockState.with(intProperty, blockState.get(intProperty) + 1); - field_20373.world.setBlockState(blockPos, blockState2); - field_20373.world.setBlockState(blockState2.get(FloweringCoffeeShrubBlock.HALF) == DoubleBlockHalf.LOWER ? blockPos.up() : blockPos.down(), blockState2.cycle(FloweringCoffeeShrubBlock.HALF)); + field_20373.getWorld().setBlockState(blockPos, blockState2); + field_20373.getWorld().setBlockState(blockState2.get(FloweringCoffeeShrubBlock.HALF) == DoubleBlockHalf.LOWER ? blockPos.up() : blockPos.down(), blockState2.cycle(FloweringCoffeeShrubBlock.HALF)); } } if (bl) { - field_20373.world.syncWorldEvent(2005, blockPos, 0); + field_20373.getWorld().syncWorldEvent(2005, blockPos, 0); field_20373.addCropCounter(); } } diff --git a/src/main/java/com/chikoritalover/caffeinated/mixin/ItemMixin.java b/src/main/java/com/chikoritalover/caffeinated/mixin/ItemMixin.java index 4f5140e..d0217f6 100644 --- a/src/main/java/com/chikoritalover/caffeinated/mixin/ItemMixin.java +++ b/src/main/java/com/chikoritalover/caffeinated/mixin/ItemMixin.java @@ -1,7 +1,7 @@ package com.chikoritalover.caffeinated.mixin; -import com.chikoritalover.caffeinated.registry.ModEntityTypeTags; -import com.chikoritalover.caffeinated.registry.ModItemTags; +import com.chikoritalover.caffeinated.registry.CaffeinatedEntityTypeTags; +import com.chikoritalover.caffeinated.registry.CaffeinatedItemTags; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; @@ -17,7 +17,7 @@ public class ItemMixin { @Inject(method = "finishUsing", at = @At(value = "HEAD")) public void finishUsing(ItemStack stack, World world, LivingEntity user, CallbackInfoReturnable info) { - if (stack.isIn(ModItemTags.COFFEE_FOOD) && user.getType().isIn(ModEntityTypeTags.COFFEE_INFLICTS_POISON)) { + if (stack.isIn(CaffeinatedItemTags.COFFEE_FOOD) && user.getType().isIn(CaffeinatedEntityTypeTags.COFFEE_INFLICTS_POISON)) { user.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 900)); } } diff --git a/src/main/java/com/chikoritalover/caffeinated/mixin/PlayerEntityMixin.java b/src/main/java/com/chikoritalover/caffeinated/mixin/PlayerEntityMixin.java index 7186bc4..9d3438d 100644 --- a/src/main/java/com/chikoritalover/caffeinated/mixin/PlayerEntityMixin.java +++ b/src/main/java/com/chikoritalover/caffeinated/mixin/PlayerEntityMixin.java @@ -1,6 +1,6 @@ package com.chikoritalover.caffeinated.mixin; -import com.chikoritalover.caffeinated.registry.ModStatusEffects; +import com.chikoritalover.caffeinated.registry.CaffeinatedStatusEffects; import net.minecraft.entity.player.PlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -12,8 +12,8 @@ public class PlayerEntityMixin { @Inject(method = "addExhaustion", at = @At(value = "HEAD"), cancellable = true) private void addExhaustion(float exhaustion, CallbackInfo ci) { PlayerEntity player = PlayerEntity.class.cast(this); - if (player.hasStatusEffect(ModStatusEffects.CAFFEINE)) { - int amplifier = player.getStatusEffect(ModStatusEffects.CAFFEINE).getAmplifier(); + if (player.hasStatusEffect(CaffeinatedStatusEffects.CAFFEINE)) { + int amplifier = player.getStatusEffect(CaffeinatedStatusEffects.CAFFEINE).getAmplifier(); if (player.getRandom().nextBetween(0, amplifier + 2) > 1) { ci.cancel(); } diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModBannerPatternTags.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBannerPatternTags.java similarity index 92% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModBannerPatternTags.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBannerPatternTags.java index 878da8e..f29b8e7 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModBannerPatternTags.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBannerPatternTags.java @@ -6,7 +6,7 @@ import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -public class ModBannerPatternTags { +public class CaffeinatedBannerPatternTags { public static final TagKey JAVA_PATTERN_ITEM = of("pattern_item/java"); private static TagKey of(String id) { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModBannerPatterns.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBannerPatterns.java similarity index 94% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModBannerPatterns.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBannerPatterns.java index 7ee371c..b37016a 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModBannerPatterns.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBannerPatterns.java @@ -7,7 +7,7 @@ import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; -public class ModBannerPatterns { +public class CaffeinatedBannerPatterns { public static final RegistryKey JAVA = of("java"); private static RegistryKey of(String id) { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModBlockSoundGroup.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlockSoundGroup.java similarity index 51% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModBlockSoundGroup.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlockSoundGroup.java index 2f0dafd..46e51c0 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModBlockSoundGroup.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlockSoundGroup.java @@ -3,18 +3,18 @@ import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundEvents; -public class ModBlockSoundGroup { +public class CaffeinatedBlockSoundGroup { public static final BlockSoundGroup COFFEE_BEAN_BLOCK = new BlockSoundGroup(1.0F, 1.0F, - ModSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_BREAK, - ModSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_STEP, - ModSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_PLACE, - ModSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_HIT, - ModSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_FALL + CaffeinatedSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_BREAK, + CaffeinatedSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_STEP, + CaffeinatedSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_PLACE, + CaffeinatedSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_HIT, + CaffeinatedSoundEvents.BLOCK_COFFEE_BEAN_BLOCK_FALL ); public static final BlockSoundGroup GROUND_COFFEE_BLOCK = new BlockSoundGroup(1.0F, 1.0F, - ModSoundEvents.BLOCK_GROUND_COFFEE_BREAK, + CaffeinatedSoundEvents.BLOCK_GROUND_COFFEE_BREAK, SoundEvents.BLOCK_ROOTED_DIRT_STEP, - ModSoundEvents.BLOCK_GROUND_COFFEE_PLACE, + CaffeinatedSoundEvents.BLOCK_GROUND_COFFEE_PLACE, SoundEvents.BLOCK_ROOTED_DIRT_HIT, SoundEvents.BLOCK_ROOTED_DIRT_FALL ); diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModBlockTags.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlockTags.java similarity index 93% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModBlockTags.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlockTags.java index 81e31e4..6696c36 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModBlockTags.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlockTags.java @@ -6,7 +6,7 @@ import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -public class ModBlockTags { +public class CaffeinatedBlockTags { public static final TagKey LIT_FIRES = of("lit_fires"); private static TagKey of(String id) { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModBlocks.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlocks.java similarity index 73% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModBlocks.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlocks.java index 5657a7c..beb5e91 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModBlocks.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedBlocks.java @@ -12,19 +12,19 @@ import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.Identifier; -public class ModBlocks { - public static final Block COFFEE_SHRUB = register("coffee_shrub", new CoffeeShrubBlock(AbstractBlock.Settings.of(Material.PLANT).ticksRandomly().noCollision().sounds(BlockSoundGroup.AZALEA))); - public static final Block FLOWERING_COFFEE_SHRUB = register("flowering_coffee_shrub", new FloweringCoffeeShrubBlock(AbstractBlock.Settings.of(Material.PLANT).ticksRandomly().noCollision().sounds(BlockSoundGroup.FLOWERING_AZALEA))); - public static final Block POTTED_COFFEE_SHRUB = register("potted_coffee_shrub", new FlowerPotBlock(COFFEE_SHRUB, AbstractBlock.Settings.of(Material.DECORATION).breakInstantly().nonOpaque())); - public static final Block COFFEE_BEAN_BLOCK = registerBlockWithItem("coffee_bean_block", new Block(AbstractBlock.Settings.of(Material.WOOD, MapColor.SPRUCE_BROWN).sounds(ModBlockSoundGroup.COFFEE_BEAN_BLOCK).strength(1.8F, 3.0F))); - public static final Block GROUND_COFFEE_BLOCK = registerBlockWithItem("ground_coffee_block", new SandBlock(8473899, AbstractBlock.Settings.of(Material.AGGREGATE, MapColor.SPRUCE_BROWN).strength(0.5F).sounds(ModBlockSoundGroup.GROUND_COFFEE_BLOCK))); - public static final Block COFFEE_BERRY_CRATE = registerBlockWithItem("coffee_berry_crate", new Block(AbstractBlock.Settings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).strength(2.0F, 3.0F))); - public static final Block COFFEE_CAULDRON = register("coffee_cauldron", new CoffeeCauldronBlock(AbstractBlock.Settings.copy(Blocks.CAULDRON), ModCauldronBehavior.COFFEE_CAULDRON_BEHAVIOR)); +public class CaffeinatedBlocks { + public static final Block COFFEE_SHRUB = register("coffee_shrub", new CoffeeShrubBlock(AbstractBlock.Settings.create().ticksRandomly().noCollision().sounds(BlockSoundGroup.AZALEA))); + public static final Block FLOWERING_COFFEE_SHRUB = register("flowering_coffee_shrub", new FloweringCoffeeShrubBlock(AbstractBlock.Settings.create().ticksRandomly().noCollision().sounds(BlockSoundGroup.FLOWERING_AZALEA))); + public static final Block POTTED_COFFEE_SHRUB = register("potted_coffee_shrub", new FlowerPotBlock(COFFEE_SHRUB, AbstractBlock.Settings.create().breakInstantly().nonOpaque())); + public static final Block COFFEE_BEAN_BLOCK = registerBlockWithItem("coffee_bean_block", new Block(AbstractBlock.Settings.create().mapColor(MapColor.SPRUCE_BROWN).sounds(CaffeinatedBlockSoundGroup.COFFEE_BEAN_BLOCK).strength(1.8F, 3.0F))); + public static final Block GROUND_COFFEE_BLOCK = registerBlockWithItem("ground_coffee_block", new SandBlock(8473899, AbstractBlock.Settings.create().mapColor(MapColor.SPRUCE_BROWN).strength(0.5F).sounds(CaffeinatedBlockSoundGroup.GROUND_COFFEE_BLOCK))); + public static final Block COFFEE_BERRY_CRATE = registerBlockWithItem("coffee_berry_crate", new Block(AbstractBlock.Settings.create().mapColor(MapColor.DARK_CRIMSON).sounds(BlockSoundGroup.WOOD).strength(2.0F, 3.0F))); + public static final Block COFFEE_CAULDRON = register("coffee_cauldron", new CoffeeCauldronBlock(AbstractBlock.Settings.copy(Blocks.CAULDRON), CaffeinatedCauldronBehavior.COFFEE_CAULDRON_BEHAVIOR)); public static final Block GROUND_COFFEE_CAULDRON = register("ground_coffee_cauldron", new GroundCoffeeCauldronBlock(AbstractBlock.Settings.copy(Blocks.CAULDRON).ticksRandomly())); public static Block registerBlockWithItem(String id, Block block) { Block block2 = register(id, block); - ModItems.register(block2); + CaffeinatedItems.register(block2); return block2; } diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModCauldronBehavior.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedCauldronBehavior.java similarity index 86% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModCauldronBehavior.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedCauldronBehavior.java index b4c9625..0e7d438 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModCauldronBehavior.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedCauldronBehavior.java @@ -23,13 +23,13 @@ import java.util.Map; -public class ModCauldronBehavior { +public class CaffeinatedCauldronBehavior { public static final Map COFFEE_CAULDRON_BEHAVIOR = CauldronBehavior.createMap(); public static final Map GROUND_COFFEE_CAULDRON_BEHAVIOR = CauldronBehavior.createMap(); public static void register() { - CauldronBehavior.EMPTY_CAULDRON_BEHAVIOR.put(ModItems.COFFEE_BOTTLE, (state, world, pos, player, hand, stack) -> { - if (stack.getItem() != ModItems.COFFEE_BOTTLE) { + CauldronBehavior.EMPTY_CAULDRON_BEHAVIOR.put(CaffeinatedItems.COFFEE_BOTTLE, (state, world, pos, player, hand, stack) -> { + if (stack.getItem() != CaffeinatedItems.COFFEE_BOTTLE) { return ActionResult.PASS; } else { if (!world.isClient) { @@ -37,7 +37,7 @@ public static void register() { player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(Items.GLASS_BOTTLE))); player.incrementStat(Stats.USE_CAULDRON); player.incrementStat(Stats.USED.getOrCreateStat(item)); - world.setBlockState(pos, ModBlocks.COFFEE_CAULDRON.getDefaultState()); + world.setBlockState(pos, CaffeinatedBlocks.COFFEE_CAULDRON.getDefaultState()); world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); world.emitGameEvent(null, GameEvent.FLUID_PLACE, pos); } @@ -46,8 +46,8 @@ public static void register() { } }); - CauldronBehavior.WATER_CAULDRON_BEHAVIOR.put(ModItems.GROUND_COFFEE, (state, world, pos, player, hand, stack) -> { - if (stack.getItem() != ModItems.GROUND_COFFEE) { + CauldronBehavior.WATER_CAULDRON_BEHAVIOR.put(CaffeinatedItems.GROUND_COFFEE, (state, world, pos, player, hand, stack) -> { + if (stack.getItem() != CaffeinatedItems.GROUND_COFFEE) { return ActionResult.PASS; } else { IntProperty level3 = Properties.LEVEL_3; @@ -57,8 +57,8 @@ public static void register() { player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(Blocks.AIR))); player.incrementStat(Stats.USE_CAULDRON); player.incrementStat(Stats.USED.getOrCreateStat(item)); - world.setBlockState(pos, ModBlocks.GROUND_COFFEE_CAULDRON.getDefaultState().with(level3, state.get(level3))); - world.playSound(null, pos, ModSoundEvents.ITEM_GROUND_COFFEE_SPLASH, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.setBlockState(pos, CaffeinatedBlocks.GROUND_COFFEE_CAULDRON.getDefaultState().with(level3, state.get(level3))); + world.playSound(null, pos, CaffeinatedSoundEvents.ITEM_GROUND_COFFEE_SPLASH, SoundCategory.BLOCKS, 1.0F, 1.0F); world.emitGameEvent(null, GameEvent.FLUID_PLACE, pos); } @@ -69,8 +69,8 @@ public static void register() { COFFEE_CAULDRON_BEHAVIOR.put(Items.GLASS_BOTTLE, (state, world, pos, player, hand, stack) -> { if (!world.isClient) { Item item = stack.getItem(); - player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(ModItems.COFFEE_BOTTLE))); - player.incrementStat(ModStats.COFFEE_TAKEN); + player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(CaffeinatedItems.COFFEE_BOTTLE))); + player.incrementStat(CaffeinatedStats.COFFEE_TAKEN); player.incrementStat(Stats.USED.getOrCreateStat(item)); LeveledCauldronBlock.decrementFluidLevel(state, world, pos); world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); @@ -84,8 +84,8 @@ public static void register() { return ActionResult.success(world.isClient); }); - COFFEE_CAULDRON_BEHAVIOR.put(ModItems.COFFEE_BOTTLE, (state, world, pos, player, hand, stack) -> { - if (state.get(LeveledCauldronBlock.LEVEL) != 3 && stack.getItem() == ModItems.COFFEE_BOTTLE) { + COFFEE_CAULDRON_BEHAVIOR.put(CaffeinatedItems.COFFEE_BOTTLE, (state, world, pos, player, hand, stack) -> { + if (state.get(LeveledCauldronBlock.LEVEL) != 3 && stack.getItem() == CaffeinatedItems.COFFEE_BOTTLE) { if (!world.isClient) { player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(Items.GLASS_BOTTLE))); player.incrementStat(Stats.USED.getOrCreateStat(stack.getItem())); diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModEntityTypeTags.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedEntityTypeTags.java similarity index 93% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModEntityTypeTags.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedEntityTypeTags.java index 3498c17..53e02ff 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModEntityTypeTags.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedEntityTypeTags.java @@ -6,7 +6,7 @@ import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -public class ModEntityTypeTags { +public class CaffeinatedEntityTypeTags { public static final TagKey> COFFEE_INFLICTS_POISON = of("coffee_inflicts_poison"); private static TagKey> of(String id) { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModFoodComponents.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedFoodComponents.java similarity index 69% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModFoodComponents.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedFoodComponents.java index 71bda5c..80ade9d 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModFoodComponents.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedFoodComponents.java @@ -1,11 +1,10 @@ package com.chikoritalover.caffeinated.registry; import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; import net.minecraft.item.FoodComponent; -public class ModFoodComponents { +public class CaffeinatedFoodComponents { public static final FoodComponent COFFEE_BERRIES = (new FoodComponent.Builder()).hunger(2).saturationModifier(0.1F).build(); - public static final FoodComponent COFFEE_BOTTLE = (new FoodComponent.Builder()).hunger(2).saturationModifier(0.3F).statusEffect(new StatusEffectInstance(ModStatusEffects.CAFFEINE, 3600, 0), 1.0F).build(); - public static final FoodComponent TIRAMISU = (new FoodComponent.Builder()).hunger(5).saturationModifier(0.6F).statusEffect(new StatusEffectInstance(ModStatusEffects.CAFFEINE, 600, 1), 1.0F).build(); + public static final FoodComponent COFFEE_BOTTLE = (new FoodComponent.Builder()).hunger(2).saturationModifier(0.3F).statusEffect(new StatusEffectInstance(CaffeinatedStatusEffects.CAFFEINE, 3600, 0), 1.0F).build(); + public static final FoodComponent TIRAMISU = (new FoodComponent.Builder()).hunger(5).saturationModifier(0.6F).statusEffect(new StatusEffectInstance(CaffeinatedStatusEffects.CAFFEINE, 600, 1), 1.0F).build(); } diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModItemTags.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedItemTags.java similarity index 93% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModItemTags.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedItemTags.java index 7a0ea39..1993713 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModItemTags.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedItemTags.java @@ -6,7 +6,7 @@ import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -public class ModItemTags { +public class CaffeinatedItemTags { public static final TagKey COFFEE_FOOD = of("coffee_food"); private static TagKey of(String id) { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModItems.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedItems.java similarity index 77% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModItems.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedItems.java index c34973e..d90b917 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModItems.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedItems.java @@ -11,13 +11,13 @@ import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -public class ModItems { - public static final Item COFFEE_BERRIES = register("coffee_berries", new Item(new Item.Settings().food(ModFoodComponents.COFFEE_BERRIES))); - public static final Item COFFEE_BEANS = register("coffee_beans", new AliasedBlockItem(ModBlocks.COFFEE_SHRUB, new Item.Settings())); +public class CaffeinatedItems { + public static final Item COFFEE_BERRIES = register("coffee_berries", new Item(new Item.Settings().food(CaffeinatedFoodComponents.COFFEE_BERRIES))); + public static final Item COFFEE_BEANS = register("coffee_beans", new AliasedBlockItem(CaffeinatedBlocks.COFFEE_SHRUB, new Item.Settings())); public static final Item GROUND_COFFEE = register("ground_coffee", new Item(new Item.Settings())); - public static final Item COFFEE_BOTTLE = register("coffee_bottle", new CoffeeBottleItem(new Item.Settings().food(ModFoodComponents.COFFEE_BOTTLE).maxCount(16).recipeRemainder(Items.GLASS_BOTTLE))); - public static final Item JAVA_BANNER_PATTERN = register("java_banner_pattern", new BannerPatternItem(ModBannerPatternTags.JAVA_PATTERN_ITEM, (new Item.Settings()).maxCount(1))); - public static final Item TIRAMISU = register("tiramisu", new Item(new Item.Settings().food(ModFoodComponents.TIRAMISU))); + public static final Item COFFEE_BOTTLE = register("coffee_bottle", new CoffeeBottleItem(new Item.Settings().food(CaffeinatedFoodComponents.COFFEE_BOTTLE).maxCount(16).recipeRemainder(Items.GLASS_BOTTLE))); + public static final Item JAVA_BANNER_PATTERN = register("java_banner_pattern", new BannerPatternItem(CaffeinatedBannerPatternTags.JAVA_PATTERN_ITEM, (new Item.Settings()).maxCount(1))); + public static final Item TIRAMISU = register("tiramisu", new Item(new Item.Settings().food(CaffeinatedFoodComponents.TIRAMISU))); public static Item register(Block block) { return register(new BlockItem(block, new Item.Settings())); @@ -49,8 +49,8 @@ public static void register() { } public static void registerCompostingChances() { - CompostingChanceRegistry.INSTANCE.add(ModBlocks.COFFEE_BEAN_BLOCK, 0.65F); - CompostingChanceRegistry.INSTANCE.add(ModBlocks.GROUND_COFFEE_BLOCK, 0.65F); + CompostingChanceRegistry.INSTANCE.add(CaffeinatedBlocks.COFFEE_BEAN_BLOCK, 0.65F); + CompostingChanceRegistry.INSTANCE.add(CaffeinatedBlocks.GROUND_COFFEE_BLOCK, 0.65F); CompostingChanceRegistry.INSTANCE.add(COFFEE_BEANS, 0.5F); CompostingChanceRegistry.INSTANCE.add(GROUND_COFFEE, 0.5F); CompostingChanceRegistry.INSTANCE.add(COFFEE_BERRIES, 0.65F); @@ -59,7 +59,7 @@ public static void registerCompostingChances() { public static void registerItemGroups() { ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register(entries -> { - entries.addAfter(Blocks.HONEYCOMB_BLOCK, ModBlocks.COFFEE_BEAN_BLOCK, ModBlocks.GROUND_COFFEE_BLOCK); + entries.addAfter(Blocks.HONEYCOMB_BLOCK, CaffeinatedBlocks.COFFEE_BEAN_BLOCK, CaffeinatedBlocks.GROUND_COFFEE_BLOCK); entries.addAfter(Items.SWEET_BERRIES, COFFEE_BEANS); }); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register(entries -> { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModParticleTypes.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedParticleTypes.java similarity index 93% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModParticleTypes.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedParticleTypes.java index a0609d9..dec836a 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModParticleTypes.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedParticleTypes.java @@ -7,7 +7,7 @@ import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -public class ModParticleTypes { +public class CaffeinatedParticleTypes { public static final DefaultParticleType COFFEE_POP = FabricParticleTypes.simple(); public static void register() { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModPlacedFeatures.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedPlacedFeatures.java similarity index 95% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModPlacedFeatures.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedPlacedFeatures.java index e46d837..fb39842 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModPlacedFeatures.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedPlacedFeatures.java @@ -10,7 +10,7 @@ import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.feature.PlacedFeature; -public class ModPlacedFeatures { +public class CaffeinatedPlacedFeatures { public static final RegistryKey PATCH_COFFEE_SHRUB = RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(Caffeinated.MODID, "patch_coffee_shrub")); public static void register() { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModSoundEvents.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedSoundEvents.java similarity index 97% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModSoundEvents.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedSoundEvents.java index 8c9e73e..d294b07 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModSoundEvents.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedSoundEvents.java @@ -6,7 +6,7 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; -public class ModSoundEvents { +public class CaffeinatedSoundEvents { public static final SoundEvent BLOCK_CAULDRON_BREW = register("block.cauldron.brew"); public static final SoundEvent BLOCK_CAULDRON_BUBBLE = register("block.cauldron.bubble"); diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModStats.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedStats.java similarity index 95% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModStats.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedStats.java index 29852cd..f791f77 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModStats.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedStats.java @@ -7,7 +7,7 @@ import net.minecraft.stat.Stats; import net.minecraft.util.Identifier; -public class ModStats { +public class CaffeinatedStats { public static final Identifier COFFEE_TAKEN = register("coffee_taken", StatFormatter.DEFAULT); private static Identifier register(String id, StatFormatter formatter) { diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModStatusEffects.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedStatusEffects.java similarity index 95% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModStatusEffects.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedStatusEffects.java index 8669352..c019415 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModStatusEffects.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedStatusEffects.java @@ -8,7 +8,7 @@ import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -public class ModStatusEffects { +public class CaffeinatedStatusEffects { public static final StatusEffect CAFFEINE = register("caffeine", StatusEffectCategory.BENEFICIAL, 4927777); private static StatusEffect register(String id, StatusEffectCategory category, int i){ diff --git a/src/main/java/com/chikoritalover/caffeinated/registry/ModTradeOffers.java b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedTradeOffers.java similarity index 67% rename from src/main/java/com/chikoritalover/caffeinated/registry/ModTradeOffers.java rename to src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedTradeOffers.java index d4f23c6..e0a4790 100644 --- a/src/main/java/com/chikoritalover/caffeinated/registry/ModTradeOffers.java +++ b/src/main/java/com/chikoritalover/caffeinated/registry/CaffeinatedTradeOffers.java @@ -4,16 +4,16 @@ import net.minecraft.village.TradeOffers; import net.minecraft.village.VillagerProfession; -public class ModTradeOffers { +public class CaffeinatedTradeOffers { public static void register() { TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 3, factories -> { - factories.add(new TradeOffers.BuyForOneEmeraldFactory(ModItems.COFFEE_BERRIES, 8, 12, 20)); + factories.add(new TradeOffers.BuyForOneEmeraldFactory(CaffeinatedItems.COFFEE_BERRIES, 8, 12, 20)); }); TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 5, factories -> { - factories.add(new TradeOffers.SellItemFactory(ModItems.TIRAMISU, 3, 1, 12, 30)); + factories.add(new TradeOffers.SellItemFactory(CaffeinatedItems.TIRAMISU, 3, 1, 12, 30)); }); TradeOfferHelper.registerWanderingTraderOffers(1, factories -> { - factories.add(new TradeOffers.SellItemFactory(ModItems.COFFEE_BEANS, 1, 1, 12, 1)); + factories.add(new TradeOffers.SellItemFactory(CaffeinatedItems.COFFEE_BEANS, 1, 1, 12, 1)); }); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 544d4a5..105d0dd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -20,7 +20,7 @@ "com.chikoritalover.caffeinated.CaffeinatedClient" ], "fabric-datagen": [ - "com.chikoritalover.caffeinated.CaffeinatedDatagen" + "com.chikoritalover.caffeinated.CaffeinatedDataGenerator" ], "main": [ "com.chikoritalover.caffeinated.Caffeinated" @@ -30,9 +30,9 @@ "caffeinated.mixins.json" ], "depends": { - "fabricloader": ">=0.14.11", + "fabricloader": ">=0.14.21", "fabric-api": "*", - "minecraft": "~1.19.2", + "minecraft": "~1.20.0", "java": ">=17" }, "suggests": {