Skip to content

Commit

Permalink
remove fruity fluid functionality, make chimenys solid, make oven rec…
Browse files Browse the repository at this point in the history
…ipes take longer for non-oven recipe items, other tweaks.
  • Loading branch information
eerussianguy committed Sep 1, 2024
1 parent 4d609b8 commit bb7b655
Show file tree
Hide file tree
Showing 48 changed files with 248 additions and 160 deletions.
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
### Changes
- Fix an issue where bees tended to not despawn.
- Wrote two chapters for wine-related features in the field guide.
- Added info for the jarring station to the field guide.
- Allow crafting the pumping station with all bronze types.
- Fix some visual possible bugs with the compost tumbler.
- Added a config option to make the compost tumbler and pumping station trivially powerable via redstone.
- Vats no longer produce fruity fluid. Instead, you may click on them directly with an empty jar with lid to get jam. Proper rendering for this is TBD.
- Chimneys are now a completely solid block.
- Fruity fluid is now called "UNUSED" as it is not used anymore.
- Increased the default time for non-oven recipes in the oven to 1 in-game hour. This effectively means that it will take extra time to 'burn' bread and meat.
- Made items that have the 'Oven Baked' trait heat slightly slower in the oven.
- Updated the jade display for ovens.
- Recipe changes from the last update didn't get added for some reason, so these are included now. Enjoy.
3 changes: 2 additions & 1 deletion resources/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,8 @@ def water_based_fluid(rm: ResourceManager, name: str):
'fluid': 'firmalife:%s' % name
})
item.with_lang(lang('%s bucket', name))
rm.lang('fluid.firmalife.%s' % name, lang(name))

rm.lang('fluid.firmalife.%s' % name, lang(name) if name != 'fruity_fluid' else 'UNUSED')

def four_ways(model: str) -> List[Dict[str, Any]]:
return [
Expand Down
3 changes: 2 additions & 1 deletion resources/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ class Wood(NamedTuple):
'firmalife.jade.slices': 'Slices: %s',
'firmalife.jade.cure_time_left': 'Curing Time Left: %s',
'firmalife.jade.cannot_cure': 'Not hot enough to cure!',
'firmalife.jade.cook_left': 'Cook Time: %s',
'firmalife.jade.cook_left': '%s: %s',
'firmalife.jade.cook_left_temp': '%s: %s (%s)',
'firmalife.jade.boiling': 'Boiling',
'firmalife.jade.not_insulated': 'Not insulated!',
'firmalife.jade.no_chimney': 'Missing chimney!',
Expand Down
2 changes: 1 addition & 1 deletion resources/generate_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def make_book(rm: ResourceManager, i18n: I18n, local_instance: bool = False, rev
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'),
crafting('firmalife:crafting/jarring_station', text_contents='The $(thing)Jarring Station$() is used to fill jars from the vat. The jarring station has a spout on one side that should point to the station.'),
text('Using the Vat, Sugar Water can be made by adding sweetener to water. Then, adding fruit causes $(thing)Fruity Fluid$() to be made. Putting a jar in the vat can then fill it. Be careful: trying to pipe or transport fruity fluid through too many transfers could ruin it!'),
text('Using the Vat, Sugar Water can be made by adding sweetener to water. Then, adding fruit causes $(thing)Fruity Fluid$() to be made. Clicking it with an $(thing)Empty Jar With Lid$() will fill it. Be careful: trying to pipe or transport fruity fluid through too many transfers could ruin it!'),
text('With $(item)$(k:key.use)$(), add empty jars with lids to the jarring station. When it detects fruity fluid, it will automatically fill the jars with $(thing)Jam$() and seal them, requiring 500 mB of fruity fluid per jar.'),
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. The pot is only able to be used for making soup. It cannot execute regular pot recipes.'),
empty_last_page()
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"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.": "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.",
"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!": "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!",
"The $(thing)Jarring Station$() is used to fill jars from the vat. The jarring station has a spout on one side that should point to the station.": "The $(thing)Jarring Station$() is used to fill jars from the vat. The jarring station has a spout on one side that should point to the station.",
"Using the Vat, Sugar Water can be made by adding sweetener to water. Then, adding fruit causes $(thing)Fruity Fluid$() to be made. Putting a jar in the vat can then fill it. Be careful: trying to pipe or transport fruity fluid through too many transfers could ruin it!": "Using the Vat, Sugar Water can be made by adding sweetener to water. Then, adding fruit causes $(thing)Fruity Fluid$() to be made. Putting a jar in the vat can then fill it. Be careful: trying to pipe or transport fruity fluid through too many transfers could ruin it!",
"Using the Vat, Sugar Water can be made by adding sweetener to water. Then, adding fruit causes $(thing)Fruity Fluid$() to be made. Clicking it with an $(thing)Empty Jar With Lid$() will fill it. Be careful: trying to pipe or transport fruity fluid through too many transfers could ruin it!": "Using the Vat, Sugar Water can be made by adding sweetener to water. Then, adding fruit causes $(thing)Fruity Fluid$() to be made. Clicking it with an $(thing)Empty Jar With Lid$() will fill it. Be careful: trying to pipe or transport fruity fluid through too many transfers could ruin it!",
"With $(item)$(k:key.use)$(), add empty jars with lids to the jarring station. When it detects fruity fluid, it will automatically fill the jars with $(thing)Jam$() and seal them, requiring 500 mB of fruity fluid per jar.": "With $(item)$(k:key.use)$(), add empty jars with lids to the jarring station. When it detects fruity fluid, it will automatically fill the jars with $(thing)Jam$() and seal them, requiring 500 mB of fruity fluid per jar.",
"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. The pot is only able to be used for making soup. It cannot execute regular pot recipes.": "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. The pot is only able to be used for making soup. It cannot execute regular pot recipes.",
"Bread": "Bread",
Expand Down
4 changes: 2 additions & 2 deletions resources/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def chisel_stair_slab(name: str, ingredient: str):
make_jar(rm, jar, remainder, ing)
for fruit in FL_FRUITS:
ing = not_rotten(has_trait('firmalife:food/%s' % fruit, 'firmalife:dried', True))
vat_recipe(rm, '%s_jar' % fruit, ing, '500 firmalife:sugar_water', output_fluid='500 firmalife:fruity_fluid', jar='firmalife:jar/%s' % fruit)
vat_recipe(rm, '%s_jar' % fruit, ing, '500 firmalife:sugar_water', jar='firmalife:jar/%s' % fruit)
for count in (2, 3, 4):
rm.recipe(('pot', 'jam_%s_%s' % (fruit, count)), 'tfc:pot_jam', {
'ingredients': [ing] * count + [utils.ingredient('#tfc:sweetener')],
Expand All @@ -189,7 +189,7 @@ def chisel_stair_slab(name: str, ingredient: str):
rm.crafting_shapeless('crafting/unseal_%s_jar' % fruit, (not_rotten('firmalife:jar/%s' % fruit), ), 'firmalife:jar/%s_unsealed' % fruit).with_advancement('firmalife:jar/%s' % fruit)
for fruit in TFC_FRUITS:
ing = not_rotten(has_trait('tfc:food/%s' % fruit, 'firmalife:dried', True))
vat_recipe(rm, '%s_jar' % fruit, ing, '500 firmalife:sugar_water', output_fluid='500 firmalife:fruity_fluid', jar='tfc:jar/%s' % fruit)
vat_recipe(rm, '%s_jar' % fruit, ing, '500 firmalife:sugar_water', jar='tfc:jar/%s' % fruit)

beet = not_rotten('tfc:food/beet')
simple_pot_recipe(rm, 'beet_sugar', [beet, beet, beet, beet, beet], '100 tfc:salt_water', output_items=['minecraft:sugar', 'minecraft:sugar', 'minecraft:sugar'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
import com.eerussianguy.firmalife.common.blocks.JarringStationBlock;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.Tag;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.ItemStackHandler;

import net.dries007.tfc.common.blockentities.TickableInventoryBlockEntity;
import net.dries007.tfc.common.capabilities.Capabilities;
import net.dries007.tfc.common.capabilities.PartialItemHandler;
import net.dries007.tfc.common.items.TFCItems;
import net.dries007.tfc.util.Helpers;
Expand All @@ -29,28 +25,23 @@ public static void tick(Level level, BlockPos pos, BlockState state, JarringStat

if (level.getGameTime() % 60 == 0 && state.hasProperty(JarringStationBlock.FACING) && level.getBlockEntity(pos.relative(state.getValue(JarringStationBlock.FACING))) instanceof VatBlockEntity vat)
{
vat.getCapability(Capabilities.FLUID).ifPresent(cap -> {
final FluidStack fluid = cap.getFluidInTank(0);
int available = fluid.getAmount() / 500;
if (available > 0 && fluid.hasTag() && fluid.getTag().contains("fruit", Tag.TAG_COMPOUND))
if (vat.hasOutput())
{
final ItemStack jars = vat.getOutput();
for (int i = 0; i < SLOTS; i++)
{
final ItemStack stack = ItemStack.of(fluid.getTag().getCompound("fruit"));
for (int i = 0; i < SLOTS; i++)
if (station.inventory.getStackInSlot(i).getItem() == TFCItems.EMPTY_JAR_WITH_LID.get())
{
if (station.inventory.getStackInSlot(i).getItem() == TFCItems.EMPTY_JAR_WITH_LID.get())
{
Helpers.playSound(level, pos, SoundEvents.BOTTLE_FILL);
station.inventory.setStackInSlot(i, stack.copyWithCount(1));
cap.drain(500, IFluidHandler.FluidAction.EXECUTE);
available--;
station.markForSync();
vat.markForSync();
station.pourTicks = 45;
}
if (available == 0) break;
Helpers.playSound(level, pos, SoundEvents.BOTTLE_FILL);
station.inventory.setStackInSlot(i, jars.split(1));
station.markForSync();
vat.markForSync();
station.pourTicks = 45;
}
if (jars.isEmpty())
break;
}
});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, OvenT
// Always heat up the item regardless if it is melting or not
if (cap.getTemperature() < oven.temperature)
{
HeatCapability.addTemp(cap, oven.temperature, 2 + oven.temperature * 0.0025f); // Breaks even at 400 C
final float modifier = FoodCapability.hasTrait(inputStack, FLFoodTraits.OVEN_BAKED) ? 2f : 2 + oven.temperature + 0.0025f; // Breaks even at 400 C
HeatCapability.addTemp(cap, oven.temperature, modifier);
}

final WrappedHeatingRecipe recipe = oven.cachedRecipes[slot];
Expand All @@ -97,6 +98,7 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, OvenT
// Output transformations
outputItem.getCapability(HeatCapability.CAPABILITY).ifPresent(outputCap -> outputCap.setTemperature(oven.temperature));
FoodCapability.applyTrait(outputItem, FLFoodTraits.OVEN_BAKED);
FoodCapability.setCreationDate(outputItem, FoodCapability.getRoundedCreationDate());

// Add output to oven
oven.inventory.setStackInSlot(slot, outputItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import net.dries007.tfc.common.TFCTags;
Expand Down Expand Up @@ -49,6 +50,7 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, VatBl
public static final int CAPACITY = 10_000;

@Nullable private VatRecipe cachedRecipe = null;
private ItemStack jarOutput = ItemStack.EMPTY;

public VatBlockEntity(BlockPos pos, BlockState state)
{
Expand All @@ -58,6 +60,41 @@ public VatBlockEntity(BlockPos pos, BlockState state)
.on(new PartialItemHandler(inventory).insert(), Direction.Plane.HORIZONTAL);
}

@Override
public void loadAdditional(CompoundTag nbt)
{
super.loadAdditional(nbt);
jarOutput = ItemStack.of(nbt.getCompound("jarOutput"));
}

@Override
public void saveAdditional(CompoundTag nbt)
{
super.saveAdditional(nbt);
nbt.put("jarOutput", jarOutput.serializeNBT());
}

public boolean hasOutput()
{
return !jarOutput.isEmpty();
}

public ItemStack getOutput()
{
return jarOutput;
}

public ItemStack takeOutput()
{
markForSync();
return jarOutput.isEmpty() ? ItemStack.EMPTY : jarOutput.split(1);
}

public void setOutput(ItemStack stack)
{
this.jarOutput = stack;
}

public void handleJarring()
{
final FluidStack fluid = inventory.getFluidInTank(0);
Expand Down Expand Up @@ -106,7 +143,7 @@ public void handleCooking()
{
final VatRecipe recipe = cachedRecipe;
cachedRecipe = null;
recipe.assembleOutputs(inventory);
recipe.assembleOutputs(this, inventory);
boilingTicks = 0;
updateCachedRecipe();
markForSync();
Expand All @@ -127,6 +164,8 @@ else if (boilingTicks > 0)
public boolean isBoiling()
{
assert level != null;
if (hasOutput())
return false;
if (getBlockState().hasProperty(VatBlock.SEALED) && !getBlockState().getValue(VatBlock.SEALED))
{
return false;
Expand All @@ -141,11 +180,13 @@ public boolean isBoiling()
public static class VatInventory extends BoilingInventory
{
private final List<ItemStack> excess;
private final VatBlockEntity vat;

public VatInventory(InventoryBlockEntity<?> entity)
{
super(entity, 1, new InventoryFluidTank(CAPACITY, fluid -> Helpers.isFluid(fluid.getFluid(), TFCTags.Fluids.USABLE_IN_POT), (VatBlockEntity) entity));
this.excess = new ArrayList<>();
this.vat = (VatBlockEntity) entity;
}

public void insertItemWithOverflow(ItemStack stack)
Expand All @@ -157,6 +198,12 @@ public void insertItemWithOverflow(ItemStack stack)
}
}

@Override
public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate)
{
return vat.hasOutput() ? ItemStack.EMPTY : super.extractItem(slot, amount, simulate);
}

@Override
public CompoundTag serializeNBT()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@

public class OvenChimneyBlock extends Block implements ICure
{
private static final VoxelShape SHAPE = Shapes.join(
Shapes.block(),
Block.box(4, 0, 4, 12, 16, 12),
BooleanOp.ONLY_FIRST
);
private static final VoxelShape SHAPE = Shapes.block();

private static final VoxelShape ALT_SHAPE = Shapes.or(
box(4, 0, 0, 12, 16, 4),
Expand All @@ -53,7 +49,7 @@ public OvenChimneyBlock(Properties properties, @Nullable Supplier<? extends Bloc

@Override
@SuppressWarnings("deprecation")
public boolean isPathfindable(BlockState pState, BlockGetter pLevel, BlockPos pPos, PathComputationType pType)
public boolean isPathfindable(BlockState state, BlockGetter level, BlockPos pos, PathComputationType type)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.dries007.tfc.common.blocks.devices.SealableDeviceBlock;
import net.dries007.tfc.common.capabilities.Capabilities;
import net.dries007.tfc.common.fluids.FluidHelpers;
import net.dries007.tfc.common.items.TFCItems;
import net.dries007.tfc.util.Helpers;

public class VatBlock extends SealableDeviceBlock
Expand Down Expand Up @@ -89,6 +90,16 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player
final ItemStack stack = player.getItemInHand(hand);
if (!vat.isBoiling())
{
if (vat.hasOutput())
{
if (stack.getItem() == TFCItems.EMPTY_JAR_WITH_LID.get())
{
stack.shrink(1);
ItemHandlerHelper.giveItemToPlayer(player, vat.takeOutput());
return InteractionResult.sidedSuccess(level.isClientSide);
}
return InteractionResult.FAIL;
}
if (stack.isEmpty() && player.isShiftKeyDown())
{
toggleSeal(level, pos, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public VatRecipe(ResourceLocation id, ItemStackIngredient ingredient, FluidStack
this.jarOutput = jarOutput;
}

public void assembleOutputs(VatBlockEntity.VatInventory inventory)
public void assembleOutputs(VatBlockEntity vat, VatBlockEntity.VatInventory inventory)
{
final ItemStack stack = Helpers.removeStack(inventory, 0);
final FluidStack fluid = inventory.drain(Integer.MAX_VALUE, IFluidHandler.FluidAction.EXECUTE);
Expand Down Expand Up @@ -117,12 +117,11 @@ else if (inputFluid.amount() == 0)
outputFluid.setAmount(Math.min(VatBlockEntity.CAPACITY, amount));
inventory.fill(outputFluid, IFluidHandler.FluidAction.EXECUTE);
}
final FluidStack current = inventory.getFluidInTank(0);
if (!current.isEmpty() && !jarOutput.isEmpty())
final ItemStack jar = this.jarOutput.copy();
if (!jar.isEmpty())
{
final CompoundTag tag = new CompoundTag();
tag.put("fruit", jarOutput.save(new CompoundTag()));
current.setTag(tag);
jar.setCount(jar.getCount() * multiplier);
vat.setOutput(jar);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static WrappedHeatingRecipe getRecipe(ItemStack stack)

public static WrappedHeatingRecipe of(HeatingRecipe recipe)
{
return new WrappedHeatingRecipe(recipe.getId(), recipe::assemble, recipe.getTemperature(), 120, false);
return new WrappedHeatingRecipe(recipe.getId(), recipe::assemble, recipe.getTemperature(), 20 * 50, false);
}

public static WrappedHeatingRecipe of(OvenRecipe recipe)
Expand Down
Loading

0 comments on commit bb7b655

Please sign in to comment.