Skip to content

Commit

Permalink
Merge for v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeblank committed Nov 1, 2021
2 parents 8b41dc7 + 72cb8af commit 61818aa
Show file tree
Hide file tree
Showing 1,819 changed files with 47,080 additions and 4,334 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/build.yml

This file was deleted.

15 changes: 9 additions & 6 deletions Baking.code-workspace
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"folders": [
{
"path": "src\\main\\resources"
}
]
{
"folders": [
{
"path": "src\\main\\resources"
},
{
"path": "C:\\Users\\hugeblank\\AppData\\Roaming\\CraftOS-PC\\computer\\3"
}
]
}
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bagel's Baking [![](http://cf.way2muchnoise.eu/full_bagels-baking_downloads.svg)![](http://cf.way2muchnoise.eu/versions/bagels-baking.svg)](https://minecraft.curseforge.com/projects/bagels-baking)
# Bagel's Baking [![](http://cf.way2muchnoise.eu/full_bagels-baking_downloads.svg)![](http://cf.way2muchnoise.eu/versions/bagels-baking.svg)](https://curseforge.com/minecraft/mc-mods/bagels-baking)

## Description
Bagel's Baking aims to add an eccentric array of food items to the game while also staying close to vanilla
Expand All @@ -18,16 +18,23 @@ which is why the comments marked with "Redeemed" exist in the code.

Progress on the mod can be found on the [unstable](https://github.com/hugeblank/Bagels_Baking/tree/unstable) branch.
Our internal spreadsheet used for asset delegations can also be viewed by the public
[here](https://docs.google.com/spreadsheets/d/1-o5NGUhOnoCGtk7y73OyeZELCU1yozdjGx30be9ZYrQ/edit?usp=sharing).
[here](https://docs.google.com/spreadsheets/d/1-o5NGUhOnoCGtk7y73OyeZELCU1yozdjGx30be9ZYrQ).

## Features
- Stews Stack to 16 per slot, instead of just 1
- Meat Burgers, Tacos, Pockets, and Sandwiches
- Expands on vanillas Cakes, Pies, and Stews
- Adds a beautiful translucent Halite & Polished Halite block, slabs, stairs, and walls
- Adds the mill block: Grind down various items like wheat or cocoa beans to get
- Adds the Mill block: Grind down various items like wheat or cocoa beans to get
crushed ingredients
- Adds Coffee, Tea, Corn, Rice, and Tomato crops
- And more: Bagels, Jams, Meringue, Chicken Nuggets, Bacon, the list goes on!
- Adds the Fermenter: Put in various items like grapes or juniper berries to create a craft beverage
- Adds the Ice Box: Throw items in that can freeze and get delicious ice cream! Or leave the box
alone and be rewarded with ice blocks!
- Adds Coffee, Tea, Corn, Rice, Tomato, Grape and Cinnamon crops
- Adds Lemon, Cherry, and Juniper forest biomes
- Adds a new villager profession, the Vintner
- Adds trellises for grape vines to grow on
- And more: Bagels, Jams, Chicken Nuggets, Bacon, Ice Creams, the list
goes on!

Screenshots of the mod can be found on [CurseForge](https://www.curseforge.com/minecraft/mc-mods/bagels-baking/screenshots)!
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use

minecraft_version=1.17
yarn_mappings=1.17+build.5
loader_version=0.11.3
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.61
loader_version=0.11.7

# Mod Properties
mod_version = 0.3.6
mod_version = 0.4.0
maven_group = dev.elexi.hugeblank
archives_base_name = bagels_baking

# Dependencies
fabric_version=0.34.9+1.17
rei_version=6.0.251-alpha
fabric_version=0.40.1+1.17
rei_version=6.0.279-alpha
798 changes: 569 additions & 229 deletions src/main/java/dev/elexi/hugeblank/bagels_baking/Baking.java

Large diffs are not rendered by default.

74 changes: 43 additions & 31 deletions src/main/java/dev/elexi/hugeblank/bagels_baking/ClientBaking.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
package dev.elexi.hugeblank.bagels_baking;

import dev.elexi.hugeblank.bagels_baking.entity.TomatoEntity;
import dev.elexi.hugeblank.bagels_baking.network.TomatoSpawnPacket;
import dev.elexi.hugeblank.bagels_baking.screen.MillScreen;
import dev.elexi.hugeblank.bagels_baking.client.IceBoxScreen;
import dev.elexi.hugeblank.bagels_baking.client.MillScreen;
import dev.elexi.hugeblank.bagels_baking.network.BakingPackets;
import dev.elexi.hugeblank.bagels_baking.network.ClientPacketHandler;
import dev.elexi.hugeblank.bagels_baking.sprite.SpriteRegistry;
import dev.elexi.hugeblank.bagels_baking.util.WoodBlock;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.TexturedRenderLayers;
import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer;
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;

import java.util.UUID;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;

public class ClientBaking implements ClientModInitializer {

public static final SpriteIdentifier ICE_BOX_NORMAL = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, new Identifier(Baking.ID,"entity/ice_box"));
public static final SpriteIdentifier ICE_BOX_LEFT = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, new Identifier(Baking.ID,"entity/ice_box_left"));
public static final SpriteIdentifier ICE_BOX_RIGHT = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, new Identifier(Baking.ID,"entity/ice_box_right"));

@Override
public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(Baking.HALITE, RenderLayer.getTranslucent());
Expand All @@ -33,32 +39,38 @@ public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(Baking.TOMATO_PLANT, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.CORN_STALK, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.RICE_PLANT, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.CINNAMON_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.CINNAMON_TREE, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.SMALL_CINNAMON_TREE, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.GRAPE_STEM, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.GRAPE_VINE, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.LEMON_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.CHERRY_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.JUNIPER_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.POTTED_LEMON_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.POTTED_CHERRY_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.POTTED_JUNIPER_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.POTTED_CINNAMON_SAPLING, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.LEMON_WOOD_TYPE.getBlock(WoodBlock.TRAPDOOR), RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.CHERRY_WOOD_TYPE.getBlock(WoodBlock.TRAPDOOR), RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.JUNIPER_WOOD_TYPE.getBlock(WoodBlock.TRAPDOOR), RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.LEMON_WOOD_TYPE.getBlock(WoodBlock.DOOR), RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.CHERRY_WOOD_TYPE.getBlock(WoodBlock.DOOR), RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(Baking.JUNIPER_WOOD_TYPE.getBlock(WoodBlock.DOOR), RenderLayer.getCutout());

SpriteRegistry.register(ICE_BOX_NORMAL);
SpriteRegistry.register(ICE_BOX_LEFT);
SpriteRegistry.register(ICE_BOX_RIGHT);

BlockEntityRendererRegistry.INSTANCE.register(Baking.ICE_BOX_ENTITY_TYPE, ChestBlockEntityRenderer::new);

ScreenRegistry.register(Baking.MILL_SCREEN, MillScreen::new);
ScreenRegistry.register(Baking.ICE_BOX_9X3, IceBoxScreen::new);
ScreenRegistry.register(Baking.ICE_BOX_9X6, IceBoxScreen::new);

EntityRendererRegistry.INSTANCE.register(Baking.TOMATO_THROWABLE, FlyingItemEntityRenderer::new);
receiveEntityPacket();
}

public void receiveEntityPacket() {
ClientSidePacketRegistry.INSTANCE.register(Baking.TOMATO_PACKET, (ctx, byteBuf) -> {
UUID uuid = byteBuf.readUuid();
int entityId = byteBuf.readVarInt();
Vec3d pos = TomatoSpawnPacket.PacketBufUtil.readVec3d(byteBuf);
float pitch = TomatoSpawnPacket.PacketBufUtil.readAngle(byteBuf);
float yaw = TomatoSpawnPacket.PacketBufUtil.readAngle(byteBuf);
ctx.getTaskQueue().execute(() -> {
if (MinecraftClient.getInstance().world == null)
throw new IllegalStateException("Tried to spawn entity in a null world!");
Entity e = new TomatoEntity(MinecraftClient.getInstance().world, pos.x, pos.y, pos.z);
e.updateTrackedPosition(pos);
e.setPos(pos.x, pos.y, pos.z);
e.setPitch(pitch);
e.setYaw(yaw);
e.setId(entityId);
e.setUuid(uuid);
MinecraftClient.getInstance().world.addEntity(entityId, e);
});
});
ClientPacketHandler.register(BakingPackets.TOMATO_PACKET);
ClientPacketHandler.register(BakingPackets.BOAT_PACKET);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,78 @@
package dev.elexi.hugeblank.bagels_baking.block;

import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CakeBlock;
import net.minecraft.block.CandleBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
import net.minecraft.tag.ItemTags;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.event.GameEvent;

public class BasicCakeBlock extends CakeBlock {
public BasicCakeBlock() {
super(FabricBlockSettings.copy(Blocks.CAKE));
public BasicCakeBlock(Settings settings) {
super(settings);
}

// Mojang bad, hugeblank good.
public static ActionResult tryEat(WorldAccess world, BlockPos pos, BlockState state, PlayerEntity player) {
if (!player.canConsume(false)) {
return ActionResult.PASS;
} else {
player.incrementStat(Stats.EAT_CAKE_SLICE);
player.getHungerManager().add(2, 0.1F);
int i = state.get(BITES);
world.emitGameEvent(player, GameEvent.EAT, pos);
if (i < 6) {
world.setBlockState(pos, state.with(BITES, i + 1), 3);
} else {
world.removeBlock(pos, false);
world.emitGameEvent(player, GameEvent.BLOCK_DESTROY, pos);
}

return ActionResult.SUCCESS;
}
}

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ItemStack itemStack = player.getStackInHand(hand);
Item item = itemStack.getItem();
if (itemStack.isIn(ItemTags.CANDLES) && state.get(BITES) == 0) {
Block block = Block.getBlockFromItem(item);
if (block instanceof CandleBlock) {
if (!player.isCreative()) {
itemStack.decrement(1);
}

world.playSound(null, pos, SoundEvents.BLOCK_CAKE_ADD_CANDLE, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.setBlockState(pos, BasicCandleCakeBlock.getCandleCakeFromCandle(this, (CandleBlock) block));
world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos);
player.incrementStat(Stats.USED.getOrCreateStat(item));
return ActionResult.SUCCESS;
}
}

if (world.isClient) {
if (tryEat(world, pos, state, player).isAccepted()) {
return ActionResult.SUCCESS;
}

if (itemStack.isEmpty()) {
return ActionResult.CONSUME;
}
}

return tryEat(world, pos, state, player);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package dev.elexi.hugeblank.bagels_baking.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CandleBlock;
import net.minecraft.block.CandleCakeBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;

import java.util.HashMap;
import java.util.Map;

public class BasicCandleCakeBlock extends CandleCakeBlock {
private final BasicCakeBlock cake;
private static final Map<BasicCakeBlock, Map<CandleBlock, BasicCandleCakeBlock>> COMBINER = new HashMap<>();

public BasicCandleCakeBlock(Block candle, BasicCakeBlock cake, Settings settings) {
super(candle, settings);
this.cake = cake;
if (COMBINER.containsKey(cake)) {
COMBINER.get(cake).put((CandleBlock) candle, this);
} else {
Map<CandleBlock, BasicCandleCakeBlock> candleCakeBlockMap = new HashMap<>();
candleCakeBlockMap.put((CandleBlock) candle, this);
COMBINER.put(cake, candleCakeBlockMap);
}

}

public static BlockState getCandleCakeFromCandle(BasicCakeBlock cake, CandleBlock candle) {
return COMBINER.get(cake).get(candle).getDefaultState();
}

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ItemStack itemStack = player.getStackInHand(hand);
if (!itemStack.isOf(Items.FLINT_AND_STEEL) && !itemStack.isOf(Items.FIRE_CHARGE)) {
if (isHittingCandle(hit) && player.getStackInHand(hand).isEmpty() && state.get(LIT)) {
extinguish(player, state, world, pos);
return ActionResult.success(world.isClient);
} else {
ActionResult actionResult = BasicCakeBlock.tryEat(world, pos, cake.getDefaultState(), player);
if (actionResult.isAccepted()) {
dropStacks(state, world, pos);
}

return actionResult;
}
} else {
return ActionResult.PASS;
}
}

@Override
public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) {
return new ItemStack(cake);
}

protected static boolean isHittingCandle(BlockHitResult hitResult) {
return hitResult.getPos().y - (double)hitResult.getBlockPos().getY() > 0.5D;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package dev.elexi.hugeblank.bagels_baking.block;

import net.minecraft.block.DoorBlock;

public class BasicDoorBlock extends DoorBlock {

public BasicDoorBlock(Settings settings) {
super(settings);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package dev.elexi.hugeblank.bagels_baking.block;

import net.minecraft.block.BlockState;
import net.minecraft.block.SnowBlock;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;

import java.util.Random;

public class BasicLayerBlock extends SnowBlock {

public BasicLayerBlock(Settings settings) {
super(settings);
}

@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {}
}
Loading

0 comments on commit 61818aa

Please sign in to comment.