Skip to content

Commit

Permalink
stovetop grill, pot, refactors, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eerussianguy committed Mar 28, 2023
1 parent 1727251 commit bb2503e
Show file tree
Hide file tree
Showing 60 changed files with 1,612 additions and 419 deletions.
3 changes: 3 additions & 0 deletions resources/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def generate(rm: ResourceManager):
tex = 'firmalife:block/%s_%s' % (trd, variant)
rm.block_model('firmalife:%s_%s' % (trd, variant), {'west': tex, 'east': tex, 'north': tex, 'south': tex, 'particle': tex, 'up': 'firmalife:block/%s_top' % trd, 'down': 'firmalife:block/%s_top' % trd})

rm.blockstate('stovetop_grill').with_lang(lang('stovetop grill')).with_tag('minecraft:mineable/pickaxe').with_block_loot('tfc:wrought_iron_grill')
rm.blockstate('stovetop_pot').with_lang(lang('stovetop pot')).with_tag('minecraft:mineable/pickaxe').with_block_loot('tfc:ceramic/pot')

rm.block_model('dribbler', parent='firmalife:block/sprinkler', textures={'0': 'firmalife:block/metal/full/stainless_steel'})
rm.blockstate('sprinkler', model='firmalife:block/sprinkler').with_lang(lang('sprinkler')).with_tag('minecraft:mineable/pickaxe').with_block_loot('firmalife:sprinkler')
rm.item_model('sprinkler', parent='firmalife:block/sprinkler', no_textures=True)
Expand Down
2 changes: 1 addition & 1 deletion resources/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Wood(NamedTuple):
'treated_wood': 'minecraft:mineable/axe'
}
COLORS = ('white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black')
BLOCK_ENTITIES = ('oven_bottom', 'oven_top', 'drying_mat', 'beehive', 'solar_drier', 'mixing_bowl', 'iron_composter', 'string', 'berry_bush', 'large_planter', 'bonsai_planter', 'trellis_planter', 'hanging_planter', 'quad_planter', 'climate_station', 'hydroponic_planter', 'vat', 'oven_hopper', 'ashtray')
BLOCK_ENTITIES = ('oven_bottom', 'oven_top', 'drying_mat', 'beehive', 'solar_drier', 'mixing_bowl', 'iron_composter', 'string', 'berry_bush', 'large_planter', 'bonsai_planter', 'trellis_planter', 'hanging_planter', 'quad_planter', 'climate_station', 'hydroponic_planter', 'vat', 'oven_hopper', 'ashtray', 'stovetop_grill', 'stovetop_pot')
EXTRA_FLUIDS = ('yeast_starter', 'coconut_milk', 'yak_milk', 'goat_milk', 'curdled_yak_milk', 'curdled_goat_milk', 'pina_colada', 'cream', 'chocolate')
JARS: Sequence[Tuple[str, int, str, str]] = (
('honey', 1, 'minecraft:block/honey_block_side', 'firmalife:raw_honey'),
Expand Down
1 change: 1 addition & 0 deletions resources/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def generate(rm: ResourceManager):
rm.item_tag('tfc:compost_greens_low', 'firmalife:fruit_leaf')
rm.item_tag('foods/cooked_meats_and_substitutes', '#tfc:foods/cooked_meats', 'firmalife:food/tofu')
rm.item_tag('forge:leather', 'firmalife:pineapple_leather')
rm.item_tag('usable_in_stovetop_soup', '#tfc:foods/usable_in_soup')

block_and_item_tag(rm, 'tfc:wild_fruits', 'firmalife:plant/pineapple_bush', 'firmalife:plant/nightshade_bush', 'firmalife:plant/fig_sapling', 'firmalife:plant/cocoa_sapling')

Expand Down
18 changes: 16 additions & 2 deletions resources/generate_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def make_book(rm: ResourceManager, i18n: I18n, local_instance: bool = False):
book.template('drying_recipe', custom_component(0, 0, 'DryingComponent', {'recipe': '#recipe'}), text_component(0, 45))

book.category('firmalife', 'Firmalife', 'All about the Firmalife addon', 'firmalife:cured_oven_top', is_sorted=True, entries=(
entry('differences_from_tfc', 'Differences from TFC (Read first!)', 'tfc:food/wheat_bread', pages=(
text('Firmalife makes a few changes to how things operate in regular TFC. This chapter exists to help direct you towards areas where this is very different.'),
text('$(l:firmalife:firmalife/cheese)Cheese$() is made through a more complex process. It can be placed in world, and has the option of aging in a $(l:firmalife:firmalife/cellar)Cellar$().', title='Cheese Aging'),
text('$(l:firmalife:firmalife/bread)Bread$() is made through a more complex process, requiring yeast and sweetener. Regular TFC bread makes flatbread, which is worse nutritionally.', title='Cheese Aging'),
text('Firmalife has a greater emphasis on sugar. While it can still be obtained through sugar cane, consider using honey (from bees) or making sugar from beets!', title='Sweeteners'),
)),
entry('cheese', 'Cheese', 'firmalife:food/gouda', pages=(
text('Making $(thing)cheese$() in Firmalife is a little more involved than in vanilla TFC. There are two new kinds of milk: $(thing)Yak Milk$(), and $(thing)Goat Milk$(). These are obtained from milking the $(l:mechanics/animal_husbandry#yak)Yak$() and $(l:mechanics/animal_husbandry#goat)Goat$(), respectively. Milking the $(l:mechanics/animal_husbandry#cow)Cow$() still produces the old kind of milk.'),
text('Like usual, milk must be $(thing)curdled$() first. To curdle milk, you need $(thing)Rennet$(). Rennet comes from the stomach of $(thing)Ruminant$() animals. This includes $(l:mechanics/animal_husbandry#yak)Yaks$(), $(l:mechanics/animal_husbandry#cow)Cows$(), $(l:mechanics/animal_husbandry#sheep)Sheep$(), $(l:mechanics/animal_husbandry#goat)Goats$(), and $(l:mechanics/animal_husbandry#musk_ox)Musk Oxen$(). To curdle milk, seal it in a $(l:mechanics/barrels)Barrel$() with Rennet for 4 hours.'),
Expand Down Expand Up @@ -167,7 +173,7 @@ def make_book(rm: ResourceManager, i18n: I18n, local_instance: bool = False):
empty_last_page()
)),
entry('ovens', 'Ovens', 'firmalife:cured_oven_top', pages=(
text('$(thing)Ovens$() are a great way of cooking lots of food in a way that improves their shelf life. Oven-baked food decays at 90% of the rate of regular food. Ovens are a multiblock structure consisting of a $(thing)Bottom Oven$(), $(thing)Top Oven$(), and optionally $(thing)Chimneys$(). These blocks start off as clay, and must be $(thing)Cured$() by raising their temperature to a certain amount for long enough.'),
text('$(thing)Ovens$() are a great way of cooking lots of food in a way that improves their shelf life. Oven-baked food decays at 90% of the rate of regular food. Ovens are a multiblock structure consisting of a $(thing)Bottom Oven$(), $(thing)Top Oven$(), and optionally $(thing)Chimneys$(). These blocks start off as clay, and must be $(thing)Cured$() by raising their temperature to a certain amount for long enough.$(br)$(l:firmalife:firmalife/oven_appliances)Oven Appliances$() extend oven functionality.'),
clay_knapping('tfc:clay_knapping/oven_top', 'The recipe for the bottom oven.'),
clay_knapping('tfc:clay_knapping/oven_bottom', 'The recipe for the top oven.'),
clay_knapping('tfc:clay_knapping/oven_chimney', 'The recipe for the oven chimney .'),
Expand All @@ -189,9 +195,17 @@ def make_book(rm: ResourceManager, i18n: I18n, local_instance: bool = False):
text('The Bottom Oven is used to hold fuel, which may only be logs. Press $(item)$(k:key.use)$() to add or remove them. The bottom oven is also the part of the oven which may be lit with a $(thing)Firestarter$() or other tool. It transfers heat contained in it to the top oven.'),
text('The Top Oven contains the items that are being cooked. It will draw heat from the Bottom Oven and slowly release it over time. This means that even if your fuel runs out, your Top Oven can continue to work for a little while. Adding items to it is as simple as pressing $(item)$(k:key.use)$(). Remember to use a $(thing)Peel$() to remove the items after.'),
text('Curing Oven blocks is easy, but requires patience. Simply start running your Bottom Oven as you would normally, and then wait. If an oven block is above 600 degrees for about 80 seconds, it will cure itself and any oven blocks around it. The curing effect will pass all the way up chimneys nearby.'),
empty_last_page()
)),
entry('oven_appliances', 'Oven Appliances', 'tfc:vat', pages=(
text('$(l:firmalife:firmalife/ovens)Ovens$() have a number of devices that interact with them, that extend their functionality. This is because ovens are modular in nature.'),
crafting('firmalife:crafting/oven_hopper', text_contents='The $(thing)Oven Hopper$() will input logs into any Bottom Oven that it is facing. It holds 16 logs (4 stacks of 4, like a log pile), and its inventory is fed by dropping items in the top. It can also be fed via automation from other mods.'),
crafting('firmalife:crafting/ashtray', text_contents='The $(thing)Ashtray$() collects $(thing)Wood Ash$() when placed below a $(thing)Bottom Oven Block$(). There is a 0.5 chance it gains ash when fuel is consumed. Ash is extracted with $(item)$(k:key.use)$() and inserted via attacking it.'),
empty_last_page()
crafting('firmalife:crafting/vat', text_contents='The $(thing)Vat$() produces some select boiling recipes in bulk. It has one slot for items, and 10,000mB of fluid space, similar to a barrel.'),
text('For example, the vat can be used to make $(thing)Olive Oil Water$() using a ratio of 1 Olive Paste to 200 mB Water. To use a vat, $(item)$(k:key.use)$() it with fluids and items to add them to the inventory. With an empty hand and $(item)$(k:key.sneak)$() held, click to seal and unseal the vat. A vat will not boil until it is sealed.'),
text('Vats should be placed on the block above a $(thing)Bottom Oven$(). If the vat would overflow on completion of the recipe, it will not boil, so be sure not to overfill it -- especially with recipes that produce more fluid than they consume!'),
two_tall_block_spotlight('', '', 'firmalife:cured_oven_bottom', 'firmalife:vat'),
text('Pots and Grills from TFC can be placed on top of a $(thing)Bottom Oven$(). These devices will get heat automatically from the bottom oven. They come with a couple restrictions: Each has only 4 slots, and the pot is only used for making soup. It cannot execute regular pot recipes.'),
)),
entry('bread', 'Bread', 'tfc:food/rye_bread', pages=(
text('To make $(thing)Bread$(), one first must get $(thing)Yeast$(). To get your first yeast, seal $(l:firmalife:firmalife/drying)Dried Fruit$() in a Barrel of $(thing)Water$(). After three days, $(thing)Yeast Starter$() will form.$(br)From now on, your yeast can be fed by sealing Yeast Starter in a Barrel with $(thing)Flour$(). This causes it to multiply. 1 flour per 100mB of Yeast produces 600mB of Yeast. That\'s a good deal!'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.function.Supplier;
import java.util.stream.Stream;

import com.eerussianguy.firmalife.client.screen.StovetopGrillScreen;
import com.eerussianguy.firmalife.client.screen.StovetopPotScreen;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.color.block.BlockColor;
Expand Down Expand Up @@ -67,7 +69,7 @@ public static void clientSetup(FMLClientSetupEvent event)
FLBlocks.CURED_OVEN_CHIMNEY, FLBlocks.QUAD_PLANTER, FLBlocks.LARGE_PLANTER, FLBlocks.HANGING_PLANTER, FLBlocks.BONSAI_PLANTER,
FLBlocks.IRON_COMPOSTER, FLBlocks.COMPOST_JAR, FLBlocks.HONEY_JAR, FLBlocks.ROTTEN_COMPOST_JAR, FLBlocks.GUANO_JAR, FLBlocks.CHEDDAR_WHEEL,
FLBlocks.RAJYA_METOK_WHEEL, FLBlocks.CHEVRE_WHEEL, FLBlocks.SHOSHA_WHEEL, FLBlocks.FETA_WHEEL, FLBlocks.GOUDA_WHEEL, FLBlocks.SMALL_CHROMITE,
FLBlocks.MIXING_BOWL, FLBlocks.BUTTERFLY_GRASS, FLBlocks.SPRINKLER, FLBlocks.DRIBBLER, FLBlocks.VAT, FLBlocks.HYDROPONIC_PLANTER
FLBlocks.MIXING_BOWL, FLBlocks.BUTTERFLY_GRASS, FLBlocks.SPRINKLER, FLBlocks.DRIBBLER, FLBlocks.VAT, FLBlocks.HYDROPONIC_PLANTER, FLBlocks.STOVETOP_GRILL, FLBlocks.STOVETOP_POT
).forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));

ItemBlockRenderTypes.setRenderLayer(FLBlocks.SOLAR_DRIER.get(), translucent);
Expand All @@ -88,6 +90,8 @@ public static void clientSetup(FMLClientSetupEvent event)

event.enqueueWork(() -> {
MenuScreens.register(FLContainerTypes.BEEHIVE.get(), BeehiveScreen::new);
MenuScreens.register(FLContainerTypes.STOVETOP_GRILL.get(), StovetopGrillScreen::new);
MenuScreens.register(FLContainerTypes.STOVETOP_POT.get(), StovetopPotScreen::new);
MenuScreens.register(FLContainerTypes.PUMPKIN.get(), KnappingScreen::new);

TFCItems.FOOD.forEach((food, item) -> {
Expand Down Expand Up @@ -149,6 +153,8 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer
event.registerBlockEntityRenderer(FLBlockEntities.MIXING_BOWL.get(), ctx -> new MixingBowlBlockEntityRenderer());
event.registerBlockEntityRenderer(FLBlockEntities.HANGER.get(), ctx -> new HangerBlockEntityRenderer());
event.registerBlockEntityRenderer(FLBlockEntities.FOOD_SHELF.get(), ctx -> new FoodShelfBlockEntityRenderer());
event.registerBlockEntityRenderer(FLBlockEntities.STOVETOP_GRILL.get(), ctx -> new StovetopGrillBlockEntityRenderer());
event.registerBlockEntityRenderer(FLBlockEntities.STOVETOP_POT.get(), ctx -> new StovetopPotBlockEntityRenderer());

event.registerEntityRenderer(FLEntities.SEED_BALL.get(), ThrownItemRenderer::new);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.eerussianguy.firmalife.client.render;

import com.eerussianguy.firmalife.common.blockentities.StovetopGrillBlockEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.world.item.ItemStack;

import net.dries007.tfc.client.RenderHelpers;
import net.dries007.tfc.common.capabilities.Capabilities;

public class StovetopGrillBlockEntityRenderer implements BlockEntityRenderer<StovetopGrillBlockEntity>
{
@Override
public void render(StovetopGrillBlockEntity grill, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay)
{
grill.getCapability(Capabilities.ITEM).ifPresent(cap -> {
for (int i = 0; i < StovetopGrillBlockEntity.SLOTS; i++)
{
ItemStack item = cap.getStackInSlot(i);
if (!item.isEmpty())
{
float yOffset = 1f / 16;
poseStack.pushPose();
poseStack.translate(0.3, 0.003125D + yOffset, 0.28);
poseStack.scale(0.3f, 0.3f, 0.3f);
poseStack.mulPose(RenderHelpers.rotateDegreesX(90F));
poseStack.mulPose(RenderHelpers.rotateDegreesZ(180F));

float translateAmount = -1.4F;
if (i == 1 || i == 3)
{
poseStack.translate(translateAmount, 0, 0);
}
if (i == 2 || i == 3)
{
poseStack.translate(0, translateAmount, 0);
}

Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, poseStack, buffer, 0);
poseStack.popPose();
}
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.eerussianguy.firmalife.client.render;

import com.eerussianguy.firmalife.common.blockentities.StovetopPotBlockEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.fluids.FluidStack;

import net.dries007.tfc.client.RenderHelpers;
import net.dries007.tfc.common.capabilities.Capabilities;
import net.dries007.tfc.common.fluids.TFCFluids;

public class StovetopPotBlockEntityRenderer implements BlockEntityRenderer<StovetopPotBlockEntity>
{
@Override
public void render(StovetopPotBlockEntity pot, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay)
{
if (pot.getLevel() == null) return;

FluidStack fluidStack = pot.getCapability(Capabilities.FLUID).map(cap -> cap.getFluidInTank(0)).orElse(FluidStack.EMPTY);
if (pot.hasOutput())
{
fluidStack = new FluidStack(Fluids.WATER, 1000);
}
if (!fluidStack.isEmpty())
{
final int color = pot.hasOutput() ? (TFCFluids.ALPHA_MASK | 0xA64214) : RenderHelpers.getFluidColor(fluidStack);
RenderHelpers.renderFluidFace(poseStack, fluidStack, buffer, color, 0.3125F, 0.3125F, 0.6875F, 0.6875F, 5f / 16, combinedOverlay, combinedLight);
}

pot.getCapability(Capabilities.ITEM).ifPresent(cap -> {
int ordinal = 0;
for (int slot = 0; slot < StovetopPotBlockEntity.SLOTS; slot++)
{
ItemStack item = cap.getStackInSlot(slot);
if (!item.isEmpty())
{
float yOffset = 1f / 16;
poseStack.pushPose();
poseStack.translate(0.5, 0.003125D + yOffset, 0.5);
poseStack.scale(0.3f, 0.3f, 0.3f);
poseStack.mulPose(RenderHelpers.rotateDegreesX(90F));
poseStack.mulPose(RenderHelpers.rotateDegreesZ(180F));

ordinal++;
poseStack.translate(0, 0, -0.12F * ordinal);

Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemTransforms.TransformType.FIXED, combinedLight, combinedOverlay, poseStack, buffer, 0);
poseStack.popPose();
}
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.eerussianguy.firmalife.client.screen;

import com.eerussianguy.firmalife.common.container.StovetopGrillContainer;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;

import net.dries007.tfc.client.screen.TFCContainerScreen;
import net.dries007.tfc.common.capabilities.heat.Heat;

public class StovetopGrillScreen extends TFCContainerScreen<StovetopGrillContainer>
{
public StovetopGrillScreen(StovetopGrillContainer container, Inventory playerInventory, Component name)
{
super(container, playerInventory, name, INVENTORY_2x2);
}


@Override
protected void renderLabels(PoseStack poseStack, int mouseX, int mouseY)
{
super.renderLabels(poseStack, mouseX, mouseY);
Heat heat = Heat.getHeat(menu.getBlockEntity().getTemperature());
if (heat != null)
{
drawCenteredLine(poseStack, heat.getDisplayName(), 64);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.eerussianguy.firmalife.client.screen;

import com.eerussianguy.firmalife.common.container.StovetopPotContainer;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;

import net.dries007.tfc.client.screen.TFCContainerScreen;
import net.dries007.tfc.common.capabilities.heat.Heat;

public class StovetopPotScreen extends TFCContainerScreen<StovetopPotContainer>
{
public StovetopPotScreen(StovetopPotContainer container, Inventory playerInventory, Component name)
{
super(container, playerInventory, name, INVENTORY_2x2);
}

@Override
protected void renderLabels(PoseStack poseStack, int mouseX, int mouseY)
{
super.renderLabels(poseStack, mouseX, mouseY);
Heat heat = Heat.getHeat(menu.getBlockEntity().getTemperature());
if (heat != null)
{
drawCenteredLine(poseStack, heat.getDisplayName(), 64);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Licensed under the EUPL, Version 1.2.
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*/

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package com.eerussianguy.firmalife.client.screen;

import javax.annotation.ParametersAreNonnullByDefault;
import net.minecraft.FieldsAreNonnullByDefault;
import net.minecraft.MethodsReturnNonnullByDefault;
Loading

0 comments on commit bb2503e

Please sign in to comment.