Skip to content

Commit

Permalink
Add coffee brewing recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikorita-Lover committed Dec 30, 2023
1 parent 5c28fff commit f3f2aa5
Show file tree
Hide file tree
Showing 12 changed files with 482 additions and 24 deletions.
20 changes: 11 additions & 9 deletions src/main/generated/.cache/c189bb4c92920ea572e0709157481155fe15e5dc
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// 1.20.1 2023-12-29T00:56:21.6334434 Caffeinated/Recipes
// 1.20.1 2023-12-30T12:03:55.5346365 Caffeinated/Recipes
8673497eb207defcf0d042ff52b307325dcef6ee data\caffeinated\advancements\recipes\misc\coffee_beans_from_campfire_cooking.json
2b1061f72b3e9a1295c9aa4334d37c9dcb3dfc53 data\caffeinated\advancements\recipes\misc\java_banner_pattern.json
a01565ba0bf9276c839227dfab5f9fa1083cb376 data\caffeinated\recipes\ground_coffee_block.json
1922870ee697bc6be35c4d62cbf7abcb35d46cf1 data\caffeinated\advancements\recipes\food\coffee_bottle.json
bb529f25b75b190a9da8518d7a0931d22cbaf194 data\caffeinated\advancements\recipes\decorations\coffee_bean_block.json
06c7edbdec5cf1deb92d8e421279587f14aaab54 data\caffeinated\advancements\recipes\food\tiramisu.json
5dfbeda6e15d9e292a25fc4e3f33d71b2ab777cb data\caffeinated\recipes\coffee_beans_from_smoking.json
f8bbfcc2f655643293992d2bc113858fedbcc78f data\caffeinated\recipes\tiramisu.json
cd15441554dc9c3417486d7787d4609ccb9888b8 data\caffeinated\recipes\ground_coffee.json
0c5f3057fe5d2ccf6a5bd511a99c41f7c9270949 data\caffeinated\advancements\recipes\misc\coffee_beans_from_smoking.json
ebc2f568cdba0689d1071919c8b4a6bd23cc8df4 data\caffeinated\recipes\coffee_bean_block.json
5721d4f7e3a65f7b6f387ec00ee996f73a2f51ee data\caffeinated\advancements\recipes\misc\coffee_beans.json
55a0f263de5782dd9ec9aecd1d1ae815e3760bdb data\caffeinated\advancements\recipes\decorations\ground_coffee_block.json
b78f30260a00fcc80fd6b65b41be9adce06286c9 data\caffeinated\recipes\coffee_beans.json
c1dd44b442244812fd79333ec001551523590d59 data\caffeinated\advancements\recipes\misc\ground_coffee.json
7ac9428c1c4810e6e439997467b8c5afad1711b9 data\caffeinated\advancements\recipes\food\coffee_berries.json
06c7edbdec5cf1deb92d8e421279587f14aaab54 data\caffeinated\advancements\recipes\food\tiramisu.json
f8bbfcc2f655643293992d2bc113858fedbcc78f data\caffeinated\recipes\tiramisu.json
ca718ec02747f39187e77abb367019198eac644e data\caffeinated\recipes\brown_dye_from_ground_coffee.json
d34b1b5cba65cbe93df946e3a6badee9edc69dc0 data\caffeinated\recipes\coffee_berries.json
7d3019bc5b37ce3328bf16cc9b8edb2eb0839802 data\caffeinated\advancements\recipes\food\tiramisu_from_slices.json
ebc2f568cdba0689d1071919c8b4a6bd23cc8df4 data\caffeinated\recipes\coffee_bean_block.json
3f815caa0d14d9f4dd898dfd686a518ba07b5408 data\caffeinated\advancements\recipes\misc\brown_dye_from_ground_coffee.json
f86c55d2f85321c89c00baa260f1964d8b81bdcf data\caffeinated\recipes\tiramisu_from_slices.json
5721d4f7e3a65f7b6f387ec00ee996f73a2f51ee data\caffeinated\advancements\recipes\misc\coffee_beans.json
21e45ee047fce833ccdc925196669db7be4d868b data\caffeinated\recipes\coffee_bottle.json
9dd043aa58724c5f9d877d84071191951a251c2b data\caffeinated\recipes\coffee_beans_from_campfire_cooking.json
d466ced2e8e679a807bdbcee307e0eb5e6547942 data\caffeinated\recipes\java_banner_pattern.json
55a0f263de5782dd9ec9aecd1d1ae815e3760bdb data\caffeinated\advancements\recipes\decorations\ground_coffee_block.json
b78f30260a00fcc80fd6b65b41be9adce06286c9 data\caffeinated\recipes\coffee_beans.json
c1dd44b442244812fd79333ec001551523590d59 data\caffeinated\advancements\recipes\misc\ground_coffee.json
7ac9428c1c4810e6e439997467b8c5afad1711b9 data\caffeinated\advancements\recipes\food\coffee_berries.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-12-29T00:56:21.6297394 Caffeinated/Model Definitions
// 1.20.1 2023-12-30T12:03:55.5316261 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
Expand All @@ -17,8 +17,8 @@ cdbc1b9ed3c8b04b24b80402af15eb777423817d assets\caffeinated\models\block\ground_
fe9155058173a06c1325878e72a8f42b0acfb9d7 assets\caffeinated\models\block\coffee_shrub_stage1.json
2078aae9dd460adbf0bf14e46615e32012f351e8 assets\caffeinated\blockstates\ground_coffee_cauldron.json
865a21f6601205d70079dbcc9d2bc9d375fbbc73 assets\caffeinated\models\block\coffee_bean_block.json
8ba76990b97aa664bf34e5e2b94761ebdc7a8c04 assets\caffeinated\models\block\coffee_cauldron_level1.json
16db00fbb67b98528c1a99e61640adc411cc4cff assets\caffeinated\models\item\tiramisu.json
8ba76990b97aa664bf34e5e2b94761ebdc7a8c04 assets\caffeinated\models\block\coffee_cauldron_level1.json
3ef771d34d7bc76165d6a5f7053ea5ff27bc44dd assets\caffeinated\blockstates\coffee_bean_block.json
821f41182077e0ce6bc7918aee907e45a9dd7d73 assets\caffeinated\models\block\soul_cauldron_campfire.json
2ee0688f44b78a48941720e3223b7bf3a9133161 assets\caffeinated\blockstates\potted_coffee_shrub.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_ground_coffee": {
"conditions": {
"items": [
{
"items": [
"caffeinated:ground_coffee"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "caffeinated:coffee_bottle"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_ground_coffee",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"caffeinated:coffee_bottle"
]
},
"sends_telemetry_event": false
}
12 changes: 12 additions & 0 deletions src/main/generated/data/caffeinated/recipes/coffee_bottle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "caffeinated:coffee_brewing",
"brewingtime": 600,
"experience": 1.0,
"ingredient": {
"item": "minecraft:potion"
},
"reagent": {
"item": "caffeinated:ground_coffee"
},
"result": "caffeinated:coffee_bottle"
}
11 changes: 11 additions & 0 deletions src/main/java/com/chikoritalover/caffeinated/Caffeinated.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.chikoritalover.caffeinated.advancement.BrewCoffeeCriterion;
import com.chikoritalover.caffeinated.block.entity.CauldronCampfireBlockEntity;
import com.chikoritalover.caffeinated.recipe.CoffeeBrewingRecipe;
import com.chikoritalover.caffeinated.registry.*;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.loot.v2.FabricLootPoolBuilder;
Expand All @@ -15,6 +16,8 @@
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.RecipeType;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
Expand All @@ -35,6 +38,14 @@ public class Caffeinated implements ModInitializer {
new Identifier(MODID, "cauldron_campfire"),
FabricBlockEntityTypeBuilder.create(CauldronCampfireBlockEntity::new, CaffeinatedBlocks.CAULDRON_CAMPFIRE, CaffeinatedBlocks.SOUL_CAULDRON_CAMPFIRE).build(null)
);
public static final RecipeSerializer<CoffeeBrewingRecipe> COFFEE_BREWING_SERIALIZER = Registry.register(Registries.RECIPE_SERIALIZER, new Identifier(MODID, "coffee_brewing"), new CoffeeBrewingRecipe.Serializer<CoffeeBrewingRecipe>(CoffeeBrewingRecipe::new, 600) {
});
public static final RecipeType<CoffeeBrewingRecipe> COFFEE_BREWING = Registry.register(Registries.RECIPE_TYPE, new Identifier(MODID, "coffee_brewing"), new RecipeType<CoffeeBrewingRecipe>(){

public String toString() {
return "coffee_brewing";
}
});

/**
* Modifies a single loot pool present in the provided builder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.chikoritalover.caffeinated.block.CauldronCampfireBlock;
import com.chikoritalover.caffeinated.block.TiramisuBlock;
import com.chikoritalover.caffeinated.recipe.CoffeeBrewingRecipeJsonBuilder;
import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks;
import com.chikoritalover.caffeinated.registry.CaffeinatedItems;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
Expand Down Expand Up @@ -123,6 +124,8 @@ public void generate(Consumer<RecipeJsonProvider> exporter) {
ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedItems.COFFEE_BERRIES, 9).input(CaffeinatedBlocks.COFFEE_BERRY_CRATE).criterion("has_coffee_berry_crate", conditionsFromItem(CaffeinatedBlocks.COFFEE_BERRY_CRATE)).offerTo(exporter);
ShapelessRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedBlocks.TIRAMISU).input(CaffeinatedItems.COFFEE_BOTTLE).input(Items.WHEAT).input(Items.SUGAR).input(Items.MILK_BUCKET).input(Items.EGG).group("tiramisu").criterion("has_coffee_bottle", conditionsFromItem(CaffeinatedItems.COFFEE_BOTTLE)).offerTo(exporter);
ShapedRecipeJsonBuilder.create(RecipeCategory.FOOD, CaffeinatedBlocks.TIRAMISU).input('#', CaffeinatedItems.TIRAMISU_SLICE).pattern("##").pattern("##").group("tiramisu").criterion("has_tiramisu_slice", conditionsFromItem(CaffeinatedItems.TIRAMISU_SLICE)).offerTo(exporter, new Identifier(Caffeinated.MODID, "tiramisu_from_slices"));

CoffeeBrewingRecipeJsonBuilder.create(Ingredient.ofItems(Items.POTION), Ingredient.ofItems(CaffeinatedItems.GROUND_COFFEE), RecipeCategory.FOOD, CaffeinatedItems.COFFEE_BOTTLE, 1.0F, 600).criterion(hasItem(CaffeinatedItems.GROUND_COFFEE), conditionsFromItem(CaffeinatedItems.GROUND_COFFEE)).offerTo(exporter);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ public void run() {
String recipeBookGroup = mappingResolver.mapClassName("intermediary", "net.minecraft.class_314");
String itemStack = "[L" + mappingResolver.mapClassName("intermediary", "net.minecraft.class_1799") + ';';
ClassTinkerers.enumBuilder(recipeBookGroup, itemStack).addEnum("CAFFEINATED_SMOKER_MISC", () -> new Object[]{new ItemStack[]{new ItemStack(Items.LAVA_BUCKET), new ItemStack(CaffeinatedItems.COFFEE_BERRIES)}}).build();
ClassTinkerers.enumBuilder(recipeBookGroup, itemStack).addEnum("CAFFEINATED_COFFEE_BREWING", () -> new Object[]{new ItemStack[]{new ItemStack(CaffeinatedItems.COFFEE_BOTTLE)}}).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
ItemStack stack = player.getStackInHand(hand);
Item item = stack.getItem();
Item item2 = cauldronCampfire.getStack(0).getItem();
boolean bl = !state.get(FILLED) && CauldronCampfireBlockEntity.isBaseIngredient(stack);
boolean bl2 = !cauldronCampfire.hasReagent() && CauldronCampfireBlockEntity.canBrewTogether(cauldronCampfire.getStack(0), stack);
boolean bl = !state.get(FILLED) && cauldronCampfire.isBaseIngredient(stack);
boolean bl2 = !cauldronCampfire.hasReagent() && cauldronCampfire.canBrewTogether(cauldronCampfire.getStack(0), stack);
boolean bl3 = state.get(FILLED) && (!item2.hasRecipeRemainder() || stack.isOf(item2.getRecipeRemainder()));
if (!bl && !bl2 && !bl3) {
return ActionResult.PASS;
Expand All @@ -123,17 +123,17 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
world.emitGameEvent(null, GameEvent.BLOCK_CHANGE, pos);
} else {
ItemStack itemStack = item2.getDefaultStack();
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
if (stack.isOf(item2.getRecipeRemainder())) {
player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, item2.getDefaultStack()));
} else {
player.giveItemStack(item2.getDefaultStack());
}
cauldronCampfire.clear();
cauldronCampfire.dropExperienceForRecipesUsed((ServerPlayerEntity) player);
world.playSound(null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.emitGameEvent(null, GameEvent.FLUID_PICKUP, pos);
if (player instanceof ServerPlayerEntity serverPlayer) {
Caffeinated.BREW_COFFEE_CRITERION.trigger(serverPlayer, itemStack);
}
Caffeinated.BREW_COFFEE_CRITERION.trigger(serverPlayer, itemStack);
}
player.incrementStat(Stats.USED.getOrCreateStat(item));
player.incrementStat(CaffeinatedStats.INTERACT_WITH_CAULDRON_CAMPFIRE);
Expand Down
Loading

0 comments on commit f3f2aa5

Please sign in to comment.