Skip to content

Commit

Permalink
Add campfire with cauldron functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikorita-Lover committed Dec 29, 2023
1 parent 0eb4c6e commit 716b82c
Show file tree
Hide file tree
Showing 27 changed files with 664 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// 1.20.1 2023-12-25T12:17:16.6255073 Caffeinated/Recipes
// 1.20.1 2023-12-29T00:56:21.6334434 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
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
0c5f3057fe5d2ccf6a5bd511a99c41f7c9270949 data\caffeinated\advancements\recipes\misc\coffee_beans_from_smoking.json
cd15441554dc9c3417486d7787d4609ccb9888b8 data\caffeinated\recipes\ground_coffee.json
0c5f3057fe5d2ccf6a5bd511a99c41f7c9270949 data\caffeinated\advancements\recipes\misc\coffee_beans_from_smoking.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
9dd043aa58724c5f9d877d84071191951a251c2b data\caffeinated\recipes\coffee_beans_from_campfire_cooking.json
5721d4f7e3a65f7b6f387ec00ee996f73a2f51ee data\caffeinated\advancements\recipes\misc\coffee_beans.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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// 1.20.1 2023-12-25T12:17:16.62302 Caffeinated/Model Definitions
// 1.20.1 2023-12-29T00:56:21.6297394 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
e8f1792493d7219e1da4ac39e45bf903a349e3f5 assets\caffeinated\models\block\ground_coffee_cauldron_full.json
cd360bb185f465f81672c32ac31312f77270e5f4 assets\caffeinated\models\block\coffee_cauldron_level2.json
57311e73aae426dff5d3b58c69ec071360f952d3 assets\caffeinated\models\block\ground_coffee_cauldron_level1.json
d233510c7f2129139eb5ce115540e88a680557d7 assets\caffeinated\blockstates\soul_cauldron_campfire.json
13297d4a51cb3b1369630338ba5f7b439b4af3fc assets\caffeinated\models\block\cauldron_campfire_filled.json
cd254ba40cfd07d6c01d66a963e5ec83ed478aef assets\caffeinated\blockstates\coffee_berry_crate.json
ace2f8060adedf59471fa9728ad427b7c2abb51e assets\caffeinated\blockstates\soul_cauldron_campfire.json
cdbc1b9ed3c8b04b24b80402af15eb777423817d assets\caffeinated\models\block\ground_coffee_cauldron_level2.json
1297909cbb77803c3f1a796d29fa088c9aeae546 assets\caffeinated\blockstates\coffee_shrub.json
34202786f9a57de99cd6cc7be5013c91a1b9690a assets\caffeinated\models\item\tiramisu_slice.json
86a7f801b70c8f877d0e3d52a8bce349a9232c4f assets\caffeinated\models\block\ground_coffee_block.json
2e82d1add55c94e56c5b85172449dc9ff539882d assets\caffeinated\models\block\coffee_cauldron_full.json
37d547b30cad973f0223896df68f15c5eea49d4b assets\caffeinated\models\item\ground_coffee_block.json
2e82d1add55c94e56c5b85172449dc9ff539882d assets\caffeinated\models\block\coffee_cauldron_full.json
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
Expand All @@ -23,13 +24,14 @@ fe9155058173a06c1325878e72a8f42b0acfb9d7 assets\caffeinated\models\block\coffee_
2ee0688f44b78a48941720e3223b7bf3a9133161 assets\caffeinated\blockstates\potted_coffee_shrub.json
358965a77d8a9ace29f9981a460163089349eda2 assets\caffeinated\models\item\coffee_berry_crate.json
196754b26a9f9cac1bf6b81563cef5344f998868 assets\caffeinated\blockstates\tiramisu.json
50804beb94c1a58c883df514333ff7d2c2807a42 assets\caffeinated\models\item\coffee_bean_block.json
ee814f36f99a123b06cf2e7bcb08415b97595925 assets\caffeinated\models\block\potted_coffee_shrub.json
50804beb94c1a58c883df514333ff7d2c2807a42 assets\caffeinated\models\item\coffee_bean_block.json
6bc7bd9e663e1a1e43a79ef46957b15c4682a3a6 assets\caffeinated\models\block\coffee_shrub_stage0.json
0dab1d0bc7608970cc968c8f8569497fae0b2295 assets\caffeinated\models\item\ground_coffee.json
8c0a558dd56b8bb92576690cceb337b2997cdf33 assets\caffeinated\blockstates\cauldron_campfire.json
ffcb5afccb3a6b30399f263654799949096594da assets\caffeinated\blockstates\cauldron_campfire.json
58f78eb6198fba07304fece9e3c7bb6247a13229 assets\caffeinated\models\item\coffee_bottle.json
6568f0e38ffcef7753bd7c0ae1bfdd66fafc6795 assets\caffeinated\models\block\cauldron_campfire.json
e4c8f2b75d3ecafc48e0a48ec6940b6dac0eb258 assets\caffeinated\models\item\coffee_beans.json
66ab3c0788a1452c84c9c06f8ffe0bf7828a9620 assets\caffeinated\models\item\java_banner_pattern.json
1564a118add7b691cd3d6b1b6d06641507f0a7e2 assets\caffeinated\models\item\coffee_berries.json
f231ba05786d3928e6a0fce4139f5e1c5b106036 assets\caffeinated\models\block\soul_cauldron_campfire_filled.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,64 @@
{
"variants": {
"facing=east,lit=false": {
"facing=east,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off",
"y": 270
},
"facing=east,lit=true": {
"facing=east,filled=false,lit=true": {
"model": "caffeinated:block/cauldron_campfire",
"y": 270
},
"facing=north,lit=false": {
"facing=east,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled",
"y": 270
},
"facing=east,filled=true,lit=true": {
"model": "caffeinated:block/cauldron_campfire_filled",
"y": 270
},
"facing=north,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off",
"y": 180
},
"facing=north,lit=true": {
"facing=north,filled=false,lit=true": {
"model": "caffeinated:block/cauldron_campfire",
"y": 180
},
"facing=south,lit=false": {
"facing=north,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled",
"y": 180
},
"facing=north,filled=true,lit=true": {
"model": "caffeinated:block/cauldron_campfire_filled",
"y": 180
},
"facing=south,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off"
},
"facing=south,lit=true": {
"facing=south,filled=false,lit=true": {
"model": "caffeinated:block/cauldron_campfire"
},
"facing=west,lit=false": {
"facing=south,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled"
},
"facing=south,filled=true,lit=true": {
"model": "caffeinated:block/cauldron_campfire_filled"
},
"facing=west,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off",
"y": 90
},
"facing=west,lit=true": {
"facing=west,filled=false,lit=true": {
"model": "caffeinated:block/cauldron_campfire",
"y": 90
},
"facing=west,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled",
"y": 90
},
"facing=west,filled=true,lit=true": {
"model": "caffeinated:block/cauldron_campfire_filled",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,64 @@
{
"variants": {
"facing=east,lit=false": {
"facing=east,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off",
"y": 270
},
"facing=east,lit=true": {
"facing=east,filled=false,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire",
"y": 270
},
"facing=north,lit=false": {
"facing=east,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled",
"y": 270
},
"facing=east,filled=true,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire_filled",
"y": 270
},
"facing=north,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off",
"y": 180
},
"facing=north,lit=true": {
"facing=north,filled=false,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire",
"y": 180
},
"facing=south,lit=false": {
"facing=north,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled",
"y": 180
},
"facing=north,filled=true,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire_filled",
"y": 180
},
"facing=south,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off"
},
"facing=south,lit=true": {
"facing=south,filled=false,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire"
},
"facing=west,lit=false": {
"facing=south,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled"
},
"facing=south,filled=true,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire_filled"
},
"facing=west,filled=false,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off",
"y": 90
},
"facing=west,lit=true": {
"facing=west,filled=false,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire",
"y": 90
},
"facing=west,filled=true,lit=false": {
"model": "caffeinated:block/cauldron_campfire_off_filled",
"y": 90
},
"facing=west,filled=true,lit=true": {
"model": "caffeinated:block/soul_cauldron_campfire_filled",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "caffeinated:block/template_cauldron_campfire_filled",
"textures": {
"fire": "minecraft:block/campfire_fire",
"lit_log": "minecraft:block/campfire_log_lit"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "caffeinated:block/template_cauldron_campfire_filled",
"textures": {
"fire": "minecraft:block/soul_campfire_fire",
"lit_log": "minecraft:block/soul_campfire_log_lit"
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/chikoritalover/caffeinated/Caffeinated.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.chikoritalover.caffeinated;

import com.chikoritalover.caffeinated.advancement.BrewCoffeeCriterion;
import com.chikoritalover.caffeinated.block.entity.CauldronCampfireBlockEntity;
import com.chikoritalover.caffeinated.registry.*;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.loot.v2.FabricLootPoolBuilder;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable;
Expand All @@ -27,6 +29,7 @@ public class Caffeinated implements ModInitializer {
// That way, it's clear which mod wrote info, warnings, and errors.
public static final String MODID = "caffeinated";
public static final Logger LOGGER = LoggerFactory.getLogger("modid");
public static final BrewCoffeeCriterion BREW_COFFEE_CRITERION = Criteria.register(new BrewCoffeeCriterion());
public static final BlockEntityType<CauldronCampfireBlockEntity> CAULDRON_CAMPFIRE = Registry.register(
Registries.BLOCK_ENTITY_TYPE,
new Identifier(MODID, "cauldron_campfire"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package com.chikoritalover.caffeinated;

import com.chikoritalover.caffeinated.block.CauldronCampfireBlock;
import com.chikoritalover.caffeinated.block.entity.CauldronCampfireBlockEntity;
import com.chikoritalover.caffeinated.registry.CaffeinatedBlocks;
import com.chikoritalover.caffeinated.registry.CaffeinatedParticleTypes;
import com.mojang.datafixers.util.Pair;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.particle.BubblePopParticle;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.entity.effect.StatusEffectInstance;
Expand All @@ -27,6 +32,13 @@ public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.CAULDRON_CAMPFIRE, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(CaffeinatedBlocks.SOUL_CAULDRON_CAMPFIRE, RenderLayer.getCutout());

ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> {
if (world == null || pos == null || world.getBlockEntity(pos) == null) {
return BiomeColors.getWaterColor(world, pos);
}
return ((CauldronCampfireBlockEntity) world.getBlockEntity(pos)).getColor();
}, CauldronCampfireBlock.CAMPFIRE_TO_CAULDRON_CAMPFIRE.values().toArray(new Block[0]));

ParticleFactoryRegistry.getInstance().register(CaffeinatedParticleTypes.COFFEE_POP, BubblePopParticle.Factory::new);

ItemTooltipCallback.EVENT.register((stack, context, lines) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ private CaffeinatedModelGenerator(FabricDataOutput output) {
public final void registerCauldronCampfire(BlockStateModelGenerator blockStateModelGenerator, Block cauldronCampfire, Block campfire) {
Identifier identifier = new Identifier(Caffeinated.MODID, "block/cauldron_campfire_off");
Identifier identifier2 = new Model(Optional.of(new Identifier(Caffeinated.MODID, "block/template_cauldron_campfire")), Optional.empty(), TextureKey.FIRE, TextureKey.LIT_LOG).upload(cauldronCampfire, TextureMap.campfire(campfire), blockStateModelGenerator.modelCollector);
blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(cauldronCampfire).coordinate(BlockStateModelGenerator.createBooleanModelMap(Properties.LIT, identifier2, identifier)).coordinate(BlockStateModelGenerator.createSouthDefaultHorizontalRotationStates()));
Identifier identifier3 = new Identifier(Caffeinated.MODID, "block/cauldron_campfire_off_filled");
Identifier identifier4 = new Model(Optional.of(new Identifier(Caffeinated.MODID, "block/template_cauldron_campfire_filled")), Optional.empty(), TextureKey.FIRE, TextureKey.LIT_LOG).upload(ModelIds.getBlockSubModelId(cauldronCampfire, "_filled"), TextureMap.campfire(campfire), blockStateModelGenerator.modelCollector);
blockStateModelGenerator.blockStateCollector.accept(VariantsBlockStateSupplier.create(cauldronCampfire).coordinate(BlockStateModelGenerator.createSouthDefaultHorizontalRotationStates()).coordinate(BlockStateVariantMap.create(Properties.LIT, CauldronCampfireBlock.FILLED).register(false, false, BlockStateVariant.create().put(VariantSettings.MODEL, identifier)).register(true, false, BlockStateVariant.create().put(VariantSettings.MODEL, identifier2)).register(false, true, BlockStateVariant.create().put(VariantSettings.MODEL, identifier3)).register(true, true, BlockStateVariant.create().put(VariantSettings.MODEL, identifier4))));
}

public final void registerCoffeeShrub(BlockStateModelGenerator blockStateModelGenerator, Block crop, Block pottedCrop, Property<Integer> ageProperty, int... ageTextureIndices) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.chikoritalover.caffeinated.advancement;

import com.chikoritalover.caffeinated.Caffeinated;
import com.google.gson.JsonObject;
import net.minecraft.advancement.criterion.AbstractCriterion;
import net.minecraft.advancement.criterion.AbstractCriterionConditions;
import net.minecraft.item.ItemStack;
import net.minecraft.predicate.entity.AdvancementEntityPredicateDeserializer;
import net.minecraft.predicate.entity.AdvancementEntityPredicateSerializer;
import net.minecraft.predicate.entity.LootContextPredicate;
import net.minecraft.predicate.item.ItemPredicate;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;

public class BrewCoffeeCriterion extends AbstractCriterion<BrewCoffeeCriterion.Conditions> {
static final Identifier ID = new Identifier(Caffeinated.MODID, "brew_coffee");

@Override
protected Conditions conditionsFromJson(JsonObject obj, LootContextPredicate playerPredicate, AdvancementEntityPredicateDeserializer predicateDeserializer) {
ItemPredicate itemPredicate = ItemPredicate.fromJson(obj.get("item"));
return new Conditions(playerPredicate, itemPredicate);
}

@Override
public Identifier getId() {
return ID;
}

public void trigger(ServerPlayerEntity player, ItemStack stack) {
this.trigger(player, conditions -> conditions.matches(stack));
}

public static class Conditions extends AbstractCriterionConditions {
private final ItemPredicate itemPredicate;

public Conditions(LootContextPredicate player, ItemPredicate item) {
super(ID, player);
this.itemPredicate = item;
}

public boolean matches(ItemStack stack) {
return this.itemPredicate.test(stack);
}

@Override
public JsonObject toJson(AdvancementEntityPredicateSerializer predicateSerializer) {
JsonObject jsonObject = super.toJson(predicateSerializer);
jsonObject.add("item", this.itemPredicate.toJson());
return jsonObject;
}
}
}
Loading

0 comments on commit 716b82c

Please sign in to comment.