Skip to content

Commit 1ab826a

Browse files
committed
feat: Add Coffee Machine #352
1 parent 7e03a94 commit 1ab826a

15 files changed

Lines changed: 325 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"variants": {
3+
"facing=east": {
4+
"model": "cookingforblockheads:block/coffee_machine",
5+
"y": 90
6+
},
7+
"facing=north": {
8+
"model": "cookingforblockheads:block/coffee_machine"
9+
},
10+
"facing=south": {
11+
"model": "cookingforblockheads:block/coffee_machine",
12+
"y": 180
13+
},
14+
"facing=west": {
15+
"model": "cookingforblockheads:block/coffee_machine",
16+
"y": 270
17+
}
18+
}
19+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"model": {
3+
"type": "minecraft:model",
4+
"model": "cookingforblockheads:block/coffee_machine"
5+
}
6+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"parent": "minecraft:recipes/root",
3+
"criteria": {
4+
"has_the_recipe": {
5+
"conditions": {
6+
"recipe": "cookingforblockheads:coffee_machine"
7+
},
8+
"trigger": "minecraft:recipe_unlocked"
9+
},
10+
"has_water_bucket": {
11+
"conditions": {
12+
"items": [
13+
{
14+
"items": "minecraft:water_bucket"
15+
}
16+
]
17+
},
18+
"trigger": "minecraft:inventory_changed"
19+
}
20+
},
21+
"requirements": [
22+
[
23+
"has_the_recipe",
24+
"has_water_bucket"
25+
]
26+
],
27+
"rewards": {
28+
"recipes": [
29+
"cookingforblockheads:coffee_machine"
30+
]
31+
}
32+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"type": "minecraft:block",
3+
"pools": [
4+
{
5+
"bonus_rolls": 0.0,
6+
"conditions": [
7+
{
8+
"condition": "minecraft:survives_explosion"
9+
}
10+
],
11+
"entries": [
12+
{
13+
"type": "minecraft:item",
14+
"name": "cookingforblockheads:coffee_machine"
15+
}
16+
],
17+
"rolls": 1.0
18+
}
19+
]
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"type": "minecraft:crafting_shaped",
3+
"category": "misc",
4+
"key": {
5+
"B": "minecraft:stone_button",
6+
"C": "minecraft:black_dye",
7+
"I": "#c:ingots/iron",
8+
"T": "minecraft:iron_trapdoor",
9+
"W": "minecraft:water_bucket"
10+
},
11+
"pattern": [
12+
" B ",
13+
"ITI",
14+
"CWI"
15+
],
16+
"result": {
17+
"id": "cookingforblockheads:coffee_machine"
18+
}
19+
}

common/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"cookingforblockheads:red_kitchen_floor",
152152
"cookingforblockheads:black_kitchen_floor",
153153
"cookingforblockheads:toaster",
154+
"cookingforblockheads:coffee_machine",
154155
"cookingforblockheads:milk_jar",
155156
"cookingforblockheads:cow_jar",
156157
"cookingforblockheads:cookie_jar"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package net.blay09.mods.cookingforblockheads.block;
2+
3+
import com.mojang.serialization.MapCodec;
4+
import net.minecraft.core.BlockPos;
5+
import net.minecraft.world.level.BlockGetter;
6+
import net.minecraft.world.level.block.BaseEntityBlock;
7+
import net.minecraft.world.level.block.Block;
8+
import net.minecraft.world.level.block.entity.BlockEntity;
9+
import net.minecraft.world.level.block.state.BlockState;
10+
import net.minecraft.world.phys.shapes.CollisionContext;
11+
import net.minecraft.world.phys.shapes.VoxelShape;
12+
import org.jspecify.annotations.Nullable;
13+
14+
public class CoffeeMachineBlock extends BaseKitchenBlock {
15+
16+
public static final MapCodec<CoffeeMachineBlock> CODEC = simpleCodec(CoffeeMachineBlock::new);
17+
18+
private static final VoxelShape SHAPE = Block.box(3, 0, 4, 13, 11, 12);
19+
20+
public CoffeeMachineBlock(Properties properties) {
21+
super(properties);
22+
}
23+
24+
@Override
25+
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
26+
return SHAPE;
27+
}
28+
29+
@Nullable
30+
@Override
31+
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
32+
return null;
33+
}
34+
35+
@Override
36+
protected MapCodec<? extends BaseEntityBlock> codec() {
37+
return CODEC;
38+
}
39+
}

common/src/main/java/net/blay09/mods/cookingforblockheads/block/ModBlocks.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class ModBlocks {
4949
public static DeferredBlock spiceRack;
5050
public static DeferredBlock fruitBasket;
5151
public static DeferredBlock cuttingBoard;
52+
public static DeferredBlock coffeeMachine;
5253
public static DiscriminatedBlocks<DyeColor> fridges;
5354
public static DiscriminatedBlocks<DyeColor> sinks;
5455
public static DiscriminatedBlocks<DyeColor> chickenSinks;
@@ -93,6 +94,10 @@ public static void initialize(BalmBlockRegistrar blocks) {
9394
.withDefaultItem(configureTooltip(Component.translatable("tooltip.cookingforblockheads.cutting_board.description")))
9495
.asDeferredBlock();
9596

97+
coffeeMachine = blocks.register("coffee_machine", CoffeeMachineBlock::new, it -> it.sound(SoundType.METAL).strength(2.5f))
98+
.withDefaultItem(configureTooltip(Component.translatable("tooltip.cookingforblockheads.coffee_machine.description")))
99+
.asDeferredBlock();
100+
96101
final var colors = supportedColors;
97102
final var colorsWithNull = new HashSet<@Nullable DyeColor>(colors);
98103
colorsWithNull.add(null);

common/src/main/java/net/blay09/mods/cookingforblockheads/item/ModItems.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static void initialize(BalmCreativeModeTabRegistrar creativeModeTabs) {
7171
output.accept(ModBlocks.milkJar);
7272
output.accept(ModBlocks.cowJar);
7373
output.accept(ModBlocks.toaster);
74+
output.accept(ModBlocks.coffeeMachine);
7475
output.accept(ModBlocks.cookieJar);
7576
output.accept(ModBlocks.toolRack);
7677
output.accept(ModBlocks.spiceRack);

common/src/main/resources/assets/cookingforblockheads/lang/en_us.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"item.cookingforblockheads.cow_jar": "Cow in a Jar",
155155
"item.cookingforblockheads.cookie_jar": "Cookie Jar",
156156
"item.cookingforblockheads.toaster": "Toaster",
157+
"item.cookingforblockheads.coffee_machine": "Coffee Machine",
157158
"item.cookingforblockheads.spice_rack": "Spice Rack",
158159
"item.cookingforblockheads.white_kitchen_floor": "Kitchen Floor",
159160
"item.cookingforblockheads.orange_kitchen_floor": "Orange Kitchen Floor",
@@ -188,6 +189,7 @@
188189
"tooltip.cookingforblockheads.cow_jar.description": "Slowly produces milk for recipes.",
189190
"tooltip.cookingforblockheads.cookie_jar.description": "Stores cookies for you.",
190191
"tooltip.cookingforblockheads.toaster.description": "Magically turns bread into toast.",
192+
"tooltip.cookingforblockheads.coffee_machine.description": "Provides essential life force.",
191193
"tooltip.cookingforblockheads.spice_rack.description": "Stores spices and ingredients.",
192194
"tooltip.cookingforblockheads.counter.description": "Stores ingredients for recipes.",
193195
"tooltip.cookingforblockheads.cabinet.description": "Can be placed on the wall above kitchen blocks.",

0 commit comments

Comments
 (0)