Skip to content

Commit

Permalink
wine shelves, etc. more work
Browse files Browse the repository at this point in the history
  • Loading branch information
eerussianguy committed Apr 28, 2024
1 parent e280370 commit aae4803
Show file tree
Hide file tree
Showing 184 changed files with 2,970 additions and 116 deletions.
36 changes: 19 additions & 17 deletions resources/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,15 @@ def generate(rm: ResourceManager):
'axis=z': {'model': 'firmalife:block/grape_trellis_string_center'}
}).with_lang(lang('grape string')).with_tag('tfc:mineable_with_sharp_tool').with_block_loot('tfc:jute_fiber')

rm.blockstate('grape_string_plant_red', variants={
'axis=x,stage=0': {'model': 'firmalife:block/grape_0', 'y': 90},
'axis=z,stage=0': {'model': 'firmalife:block/grape_0'},
'axis=x,stage=1': {'model': 'firmalife:block/grape_1', 'y': 90},
'axis=z,stage=1': {'model': 'firmalife:block/grape_1'},
'axis=x,stage=2': {'model': 'firmalife:block/grape_2', 'y': 90},
'axis=z,stage=2': {'model': 'firmalife:block/grape_2'},
}).with_lang(lang('red grape plant')).with_tag('tfc:mineable_with_sharp_tool').with_block_loot('tfc:jute_fiber')
rm.blockstate('grape_string_plant_red', variants=dict(
('axis=%s,lifecycle=%s,stage=%s' % (a, l, s), {'model': 'firmalife:block/%s_%s' % (m, s), 'y': y if y != 0 else None})
for a, y in (('x', 90), ('z', 0)) for s in range(0, 3) for l, m in (('dormant', 'grape_dead'), ('healthy', 'grape'), ('fruiting', 'grape'), ('flowering', 'grape'))
)).with_lang(lang('red grape plant')).with_tag('tfc:mineable_with_sharp_tool').with_block_loot('tfc:jute_fiber')

rm.blockstate('grape_string_plant_white', variants={
'axis=x,stage=0': {'model': 'firmalife:block/grape_0', 'y': 90},
'axis=z,stage=0': {'model': 'firmalife:block/grape_0'},
'axis=x,stage=1': {'model': 'firmalife:block/grape_1', 'y': 90},
'axis=z,stage=1': {'model': 'firmalife:block/grape_1'},
'axis=x,stage=2': {'model': 'firmalife:block/grape_2', 'y': 90},
'axis=z,stage=2': {'model': 'firmalife:block/grape_2'},
}).with_lang(lang('white grape plant')).with_tag('tfc:mineable_with_sharp_tool').with_block_loot('tfc:jute_fiber')
rm.blockstate('grape_string_plant_white', variants=dict(
('axis=%s,lifecycle=%s,stage=%s' % (a, l, s), {'model': 'firmalife:block/%s_%s' % (m, s), 'y': y if y != 0 else None})
for a, y in (('x', 90), ('z', 0)) for s in range(0, 3) for l, m in (('dormant', 'grape_dead'), ('healthy', 'grape'), ('fruiting', 'grape'), ('flowering', 'grape'))
)).with_lang(lang('white grape plant')).with_tag('tfc:mineable_with_sharp_tool').with_block_loot('tfc:jute_fiber')

rm.blockstate('grape_string_red', variants={
'axis=x,lifecycle=dormant': {'model': 'firmalife:block/grape_top_dead', 'y': 90},
Expand Down Expand Up @@ -214,12 +206,16 @@ def generate(rm: ResourceManager):
).with_lang(lang('grape_trellis_post')).with_tag('minecraft:mineable/axe').with_block_loot('firmalife:grape_trellis_post')

for color in ('red', 'white'):
rm.item_model('seeds/%s_grape' % color, 'firmalife:item/seeds/%s_grape' % color).with_lang(lang('%s grape seeds', color)).with_tag('#tfc:seeds')
rm.item_model('seeds/%s_grape' % color, 'firmalife:item/seeds/%s_grape' % color).with_lang(lang('%s grape seeds', color)).with_tag('tfc:seeds')

rm.item_model('beehive_frame_no_queen', 'firmalife:item/beehive_frame')
rm.item_model('beehive_frame_queen', 'firmalife:item/beehive_frame_queen')
item_model_property(rm, 'beehive_frame', [{'predicate': {'firmalife:queen': 1}, 'model': 'firmalife:item/beehive_frame_queen'}], {'parent': 'firmalife:item/beehive_frame_no_queen'}).with_lang(lang('beehive frame'))

for color in ('hematitic', 'olivine', 'volcanic'):
rm.block_model(f'{color}_wine_bottle', {'bottle_cork': 'firmalife:block/wine/bottle_cork', 'bottle': f'firmalife:block/wine/{color}_bottle', 'bottle_neck': f'firmalife:block/wine/{color}_bottle_neck'}, 'firmalife:block/wine_bottle')
rm.block_model(f'empty_{color}_wine_bottle', {'bottle_cork': 'tfc:block/empty'}, f'firmalife:block/{color}_wine_bottle')

rm.blockstate('climate_station', variants={
'stasis=true': {'model': 'firmalife:block/climate_station_valid'},
'stasis=false': {'model': 'firmalife:block/climate_station_invalid'}
Expand Down Expand Up @@ -419,6 +415,12 @@ def generate(rm: ResourceManager):
)).with_lang(lang('%s keg' % wood)).with_tag('minecraft:mineable/axe').with_block_loot({'name': 'firmalife:wood/big_barrel/%s' % wood, 'conditions': [loot_tables.block_state_property('firmalife:wood/big_barrel/%s[barrel_part=0]' % wood)]})
block.with_tag('firmalife:big_barrels').with_item_tag('firmalife:big_barrels')

block = rm.blockstate('wood/wine_shelf/%s' % wood, variants=four_rotations('firmalife:block/wood/wine_shelf/%s_dynamic' % wood, (90, None, 180, 270)))
block.with_block_model({'0': 'tfc:block/wood/planks/%s' % wood, '2': 'tfc:block/wood/sheet/%s' % wood, '3': 'tfc:block/wood/stripped_log/%s' % wood}, 'firmalife:block/wine_shelf')
block.with_lang(lang('%s wine shelf', wood)).with_tag('firmalife:wine_shelves').with_item_tag('firmalife:wine_shelves').with_block_loot('firmalife:wood/wine_shelf/%s' % wood).with_tag('minecraft:mineable/axe')
rm.item_model('wood/wine_shelf/%s' % wood, parent='firmalife:block/wood/wine_shelf/%s' % wood, no_textures=True)
rm.custom_block_model('firmalife:wood/wine_shelf/%s_dynamic' % wood, 'firmalife:wine_shelf', {'base': {'parent': 'firmalife:block/wood/wine_shelf/%s' % wood}})

for fruit in FRUITS.keys():
for prefix in ('', 'growing_'):
block = rm.blockstate_multipart('plant/' + fruit + '_' + prefix + 'branch',
Expand Down
7 changes: 6 additions & 1 deletion resources/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Wood(NamedTuple):

SIMPLE_ITEMS = ('fruit_leaf', 'cinnamon_bark', 'beeswax', 'pineapple_fiber', 'pineapple_leather', 'pineapple_yarn', 'raw_honey', 'rennet', 'watering_can', 'treated_lumber', 'cheesecloth', 'spoon',
'pie_pan', 'seed_ball', 'rustic_finish', 'stone_finish', 'tile_finish', 'oven_insulation', 'ice_shavings', 'beekeeper_helmet', 'beekeeper_chestplate', 'beekeeper_leggings', 'beekeeper_boots', 'reinforced_glass', 'pottery_sherd',
'hematitic_wine_bottle', 'olivine_wine_bottle', 'volcanic_wine_bottle')
'hematitic_wine_bottle', 'olivine_wine_bottle', 'volcanic_wine_bottle', 'empty_hematitic_wine_bottle', 'empty_olivine_wine_bottle', 'empty_volcanic_wine_bottle', 'cork', 'bottle_label')
SIMPLE_FOODS = ('frothy_coconut', 'white_chocolate_blend', 'dark_chocolate_blend', 'milk_chocolate_blend', 'tofu', 'soy_mixture', 'yak_curd', 'goat_curd', 'milk_curd', 'cheddar', 'chevre', 'rajya_metok', 'gouda', 'feta', 'shosha', 'butter',
'pie_dough', 'filled_pie', 'cooked_pie', 'pizza_dough', 'raw_pizza', 'cooked_pizza', 'shredded_cheese', 'pickled_egg', 'pumpkin_pie_dough', 'raw_pumpkin_pie', 'cooked_pumpkin_pie', 'cocoa_beans', 'roasted_cocoa_beans',
'cocoa_butter', 'cocoa_powder', 'toast', 'dark_chocolate', 'milk_chocolate', 'white_chocolate', 'garlic_bread', 'cured_maize', 'nixtamal', 'masa', 'masa_flour', 'corn_tortilla', 'taco_shell', 'burrito', 'taco', 'salsa',
Expand Down Expand Up @@ -249,6 +249,11 @@ class Wood(NamedTuple):
'firmalife.beehive.breed_chance_100': 'Daily New Bee Chance: Guaranteed',
'firmalife.beehive.honey_chance': 'Daily Honey Chance: 1 / %s',
'firmalife.beehive.honey_chance_100': 'Daily Honey Chance: Guaranteed',
'firmalife.wine.age_time': 'Aging for: %s',
'firmalife.wine.age_time_opened': 'Aged for: %s',
'firmalife.wine.sealed': 'Sealed',
'firmalife.wine.unsealed': 'Unsealed',
'firmalife.wine.how_to_open': 'Right click with a knife to pop the cork.',
'greenhouse.firmalife.treated_wood': 'Treated Wood',
'greenhouse.firmalife.copper': 'Copper',
'greenhouse.firmalife.iron': 'Iron',
Expand Down
3 changes: 3 additions & 0 deletions resources/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,16 @@ def generate(rm: ResourceManager):
item_size(rm, 'dynamic_foods', '#firmalife:foods/dynamic', Size.very_small, Weight.very_heavy)
item_size(rm, 'peel', 'firmalife:peel', Size.very_large, Weight.heavy)
item_size(rm, 'big_barrels', '#firmalife:big_barrels', Size.very_large, Weight.very_heavy)
item_size(rm, 'wine', '#firmalife:filled_wine_bottles', Size.very_large, Weight.very_heavy)
item_size(rm, 'empty_wine', '#firmalife:empty_wine_bottles', Size.normal, Weight.medium)

item_heat(rm, 'heatable_foods', '#firmalife:foods/heatable', 1)

for fruit, data in FRUITS.items():
climate_range(rm, 'plant/%s_tree' % fruit, hydration=(hydration_from_rainfall(data.min_rain), 100, 0), temperature=(data.min_temp - 7, data.max_temp + 7, 0))
for berry, data in STILL_BUSHES.items():
climate_range(rm, 'plant/%s_bush' % berry, hydration=(hydration_from_rainfall(data[0]), 100, 0), temperature=(data[2], data[3], 0))
climate_range(rm, 'plant/grapes', hydration=(0, 100, 0), temperature=(0, 50, 0))

damage_type(rm, 'oven', exhaustion=0.1, effects='burning')
damage_type(rm, 'swarm')
Expand Down
3 changes: 3 additions & 0 deletions resources/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def generate(rm: ResourceManager):
rm.item_tag('foods/raw_fish', *['tfc:food/%s' % fish for fish in TFC_FISH_ITEMS])
rm.item_tag('foods/cooked_fish', *['tfc:food/cooked_%s' % fish for fish in TFC_FISH_ITEMS])
rm.item_tag('foods/egg_noodle_flour', *['tfc:food/%s_flour' % g for g in TFC_GRAINS])
rm.item_tag('empty_wine_bottles', 'empty_hematitic_wine_bottle', 'empty_olivine_wine_bottle', 'empty_volcanic_wine_bottle')
rm.item_tag('filled_wine_bottles', 'hematitic_wine_bottle', 'olivine_wine_bottle', 'volcanic_wine_bottle')
rm.item_tag('wine_bottles', '#firmalife:empty_wine_bottles', '#firmalife:filled_wine_bottles')

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
6 changes: 3 additions & 3 deletions resources/validate_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from mcresources import utils

assets_path = '../src/main/resources/assets/'
texture_forgiveness_paths = ('crop', 'spice', 'fruitstuff', 'food', 'mallet', 'dried', 'pineapple', 'coconut', 'metal/full', 'cinnamon', 'block/white_wool', 'squash', 'cocoa')
texture_forgiveness_paths = ('crop', 'spice', 'fruitstuff', 'food', 'mallet', 'dried', 'pineapple', 'coconut', 'metal/full', 'cinnamon', 'block/white_wool', 'squash', 'cocoa', 'egg', 'metal/smooth')

def main():
model_locations = glob(assets_path + 'firmalife/models/**/*.json', recursive=True)
Expand Down Expand Up @@ -63,7 +63,7 @@ def validate_models_used(model_locations, known_models):
tested += 1
if f not in fixed_km:
forgiven = False
for check in ('jar_jug', 'spoon', 'block/jar'):
for check in ('jar_jug', 'spoon', 'block/jar', 'jarbnet', 'wine_bottle', 'compost_tumbler', 'planter'):
if check in f:
forgiven = True
if not forgiven:
Expand Down Expand Up @@ -107,7 +107,7 @@ def validate_textures(model_locations):
tested += 1
path = assets_path + 'firmalife/textures/%s.png' % res.path
if len(glob(path)) == 0:
print('Using missing texture, unable to load %s : java.io.FileNotFoundException: %s' % (f, path))
print('In model %s cannot find texture %s' % (f, path))
errors += 1
else:
existing_textures.append(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import com.eerussianguy.firmalife.client.model.DynamicBlockModel;
import com.eerussianguy.firmalife.client.model.QuadPlanterBlockModel;
import com.eerussianguy.firmalife.client.model.TrellisPlanterBlockModel;
import com.eerussianguy.firmalife.client.model.WineShelfBlockModel;
import com.eerussianguy.firmalife.client.screen.BigBarrelScreen;
import com.eerussianguy.firmalife.client.screen.StovetopGrillScreen;
import com.eerussianguy.firmalife.client.screen.StovetopPotScreen;
import com.eerussianguy.firmalife.common.FLCreativeTabs;
import com.eerussianguy.firmalife.common.capabilities.bee.BeeCapability;
import com.eerussianguy.firmalife.common.capabilities.bee.IBee;
import com.eerussianguy.firmalife.common.items.WineBottleItem;
import com.eerussianguy.firmalife.common.misc.SprinklerParticle;
import com.eerussianguy.firmalife.common.util.FLFruit;
import net.minecraft.ChatFormatting;
Expand Down Expand Up @@ -110,6 +112,7 @@ public static void clientSetup(FMLClientSetupEvent event)
FLBlocks.FOOD_SHELVES.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
FLBlocks.HANGERS.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
FLBlocks.JARBNETS.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
FLBlocks.WINE_SHELVES.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
FLBlocks.CURED_OVEN_BOTTOM.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
FLBlocks.CURED_OVEN_TOP.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
FLBlocks.CURED_OVEN_HOPPER.values().forEach(reg -> ItemBlockRenderTypes.setRenderLayer(reg.get(), cutout));
Expand Down Expand Up @@ -176,6 +179,14 @@ public static void registerModels(ModelEvent.RegisterAdditional event)
event.register(FLHelpers.identifier("block/jar/rotten_compost"));
event.register(FLHelpers.identifier("block/jar/guano"));
event.register(FLHelpers.identifier("block/jar/honey"));

for (Item item : ForgeRegistries.ITEMS.getValues())
{
if (item instanceof WineBottleItem wine)
{
event.register(wine.getModelLocation());
}
}
}

public static void registerLoaders(ModelEvent.RegisterGeometryLoaders event)
Expand All @@ -190,6 +201,7 @@ public static void registerLoaders(ModelEvent.RegisterGeometryLoaders event)
event.register("jarring_station", new DynamicBlockModel.Loader(JarringStationBlockModel::new));
event.register("food_shelf", new DynamicBlockModel.Loader(FoodShelfBlockModel::new));
event.register("hanger", new DynamicBlockModel.Loader(HangerBlockModel::new));
event.register("wine_shelf", new DynamicBlockModel.Loader(WineShelfBlockModel::new));
}

private static void registerDryProperty(Supplier<Item> item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import com.eerussianguy.firmalife.common.FLTags;
import com.eerussianguy.firmalife.common.capabilities.wine.WineCapability;
import com.eerussianguy.firmalife.common.util.Plantable;
import com.google.common.base.Stopwatch;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -45,6 +46,7 @@ private static void onTooltip(ItemTooltipEvent event)
if (!stack.isEmpty())
{
stack.getCapability(BeeCapability.CAPABILITY).ifPresent(cap -> cap.addTooltipInfo(text));
stack.getCapability(WineCapability.CAPABILITY).ifPresent(cap -> cap.addTooltipInfo(text));
final Plantable plantable = Plantable.get(stack);
if (plantable != null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.eerussianguy.firmalife.client.model;

import com.eerussianguy.firmalife.common.blockentities.FLBlockEntities;
import com.eerussianguy.firmalife.common.blockentities.WineShelfBlockEntity;
import com.eerussianguy.firmalife.common.blocks.WineShelfBlock;
import com.eerussianguy.firmalife.common.items.WineBottleItem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.ModelBlockRenderer;
import net.minecraft.client.renderer.block.model.ItemOverrides;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.items.IItemHandler;

import net.dries007.tfc.common.capabilities.Capabilities;
import net.dries007.tfc.util.Helpers;

public class WineShelfBlockModel extends SimpleDynamicBlockModel<WineShelfBlockEntity>
{
public WineShelfBlockModel(boolean isAmbientOcclusion, boolean isGui3d, boolean isSideLit, ItemOverrides overrides, BakedModel baseModel)
{
super(isAmbientOcclusion, isGui3d, isSideLit, overrides, baseModel);
}

@Override
public void render(WineShelfBlockEntity shelf, PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay)
{
if (!(shelf.getBlockState().getBlock() instanceof WineShelfBlock && shelf.getLevel() != null))
return;

final Minecraft mc = Minecraft.getInstance();
final ModelBlockRenderer renderer = mc.getBlockRenderer().getModelRenderer();
final Direction facing = shelf.getBlockState().getValue(WineShelfBlock.FACING);
final int angle = switch (facing)
{
case SOUTH -> 180;
case EAST -> 270;
case WEST, DOWN, UP -> 90;
case NORTH -> 0;
};

final IItemHandler inv = Helpers.getCapability(shelf, Capabilities.ITEM);
if (inv == null)
return;
for (int i = 0; i < 4; i++)
{
final ItemStack stack = inv.getStackInSlot(i);
if (stack.getItem() instanceof WineBottleItem wine)
{
poseStack.pushPose();
poseStack.translate(0.5f, 0.5f, 0.5f);
poseStack.mulPose(Axis.XP.rotationDegrees(-90f));
poseStack.mulPose(Axis.ZP.rotationDegrees(angle));
poseStack.translate(-0.5f, -0.5f, -0.5f);

poseStack.translate(i < 2 ? 0.25f : -0.25f, 1f / 16f, i % 2 == 0 ? 0.25f : -0.25f);

final BakedModel baked = mc.getModelManager().getModel(wine.getModelLocation());
renderer.tesselateWithAO(shelf.getLevel(), baked, shelf.getBlockState(), shelf.getBlockPos(), poseStack, buffer, false, RandomSource.create(), 4L, packedOverlay, ModelData.EMPTY, RenderType.cutout());

poseStack.popPose();
}
}

}

@Override
public BlockEntityType<WineShelfBlockEntity> type()
{
return FLBlockEntities.WINE_SHELF.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public static void fillFirmalifeTab(CreativeModeTab.ItemDisplayParameters parame
accept(out, FLItems.OLIVINE_WINE_BOTTLE);
accept(out, FLItems.HEMATITIC_WINE_BOTTLE);
accept(out, FLItems.VOLCANIC_WINE_BOTTLE);
accept(out, FLItems.EMPTY_OLIVINE_WINE_BOTTLE);
accept(out, FLItems.EMPTY_HEMATITIC_WINE_BOTTLE);
accept(out, FLItems.EMPTY_VOLCANIC_WINE_BOTTLE);
accept(out, FLItems.CORK);
accept(out, FLItems.RED_GRAPE_SEEDS);
accept(out, FLItems.WHITE_GRAPE_SEEDS);

Expand Down Expand Up @@ -120,6 +124,7 @@ else if (type == OvenType.TILE)
accept(out, FLBlocks.SEALED_BRICKS);
accept(out, FLBlocks.CHISELED_SEALED_BRICKS);
accept(out, FLBlocks.POLISHED_SEALED_BRICKS);
accept(out, FLBlocks.DARK_LADDER);
accept(out, FLBlocks.SEALED_DOOR);
accept(out, FLBlocks.SEALED_WALL);
accept(out, FLBlocks.SEALED_TRAPDOOR);
Expand All @@ -132,6 +137,7 @@ else if (type == OvenType.TILE)
accept(out, FLBlocks.HANGERS, wood);
accept(out, FLBlocks.JARBNETS, wood);
accept(out, FLBlocks.BIG_BARRELS, wood);
accept(out, FLBlocks.WINE_SHELVES, wood);
}

for (Carving carving : Carving.values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static class Items
public static final TagKey<Item> CAN_BE_HUNG = create("can_be_hung");
public static final TagKey<Item> USABLE_IN_STOVETOP_SOUP = create("usable_in_stovetop_soup");
public static final TagKey<Item> BEEKEEPER_ARMOR = create("beekeeper_armor");
public static final TagKey<Item> WINE_BOTTLES = create("wine_bottles");

private static TagKey<Item> create(String id)
{
Expand Down
Loading

0 comments on commit aae4803

Please sign in to comment.