Skip to content

Commit

Permalink
- Buff rennet drops
Browse files Browse the repository at this point in the history
- Add config for classic sprinkler behavior
- Disallow knapping with rotten pumpkins
  • Loading branch information
eerussianguy committed Oct 2, 2024
1 parent 4b0791a commit eae4965
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def generate(rm: ResourceManager):

### MISC DATA ###
global_loot_modifiers(rm, 'firmalife:fruit_leaf', 'firmalife:rennet', 'firmalife:rennet_three', 'firmalife:ice_shavings')
global_loot_modifier(rm, 'rennet', 'firmalife:add_item', {'item': item_stack_codec('4 firmalife:rennet')}, match_entity_tag('firmalife:drops_rennet'))
global_loot_modifier(rm, 'rennet', 'firmalife:add_item', {'item': item_stack-_codec('4 firmalife:rennet')}, match_entity_tag('firmalife:drops_rennet'))
global_loot_modifier(rm, 'rennet_three', 'firmalife:add_item', {'item': item_stack_codec('6 firmalife:rennet')}, match_entity_tag('firmalife:drops_three_rennet'))
global_loot_modifier(rm, 'fruit_leaf', 'firmalife:add_item', {'item': item_stack_codec('firmalife:fruit_leaf'), 'chance': 0.5}, match_block_ingredient('firmalife:drops_fruit_leaf'))
global_loot_modifier(rm, 'ice_shavings', 'firmalife:add_item', {'item': item_stack_codec('firmalife:ice_shavings')}, match_block_ingredient('firmalife:drops_ice_shavings'))
Expand Down
2 changes: 1 addition & 1 deletion resources/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def chisel_stair_slab(name: str, ingredient: str):
oven_recipe(rm, 'lasagna', not_rotten('firmalife:food/raw_lasagna'), 400, result_item=item_stack_provider('firmalife:food/cooked_lasagna'))

# Firmalife Recipes
knapping_type(rm, 'pumpkin', '1 #firmalife:pumpkin_knapping', None, 'tfc:item.knapping.leather', False, False, False, 'tfc:pumpkin')
knapping_type(rm, 'pumpkin', {'ingredient': not_rotten('#firmalife:pumpkin_knapping'), 'count': 1}, None, 'tfc:item.knapping.leather', False, False, False, 'tfc:pumpkin')

for carving, pattern in CARVINGS.items():
pumpkin_knapping(rm, carving, pattern, 'firmalife:carved_pumpkin/%s' % carving)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void hydroponicServerTick(Level level, BlockPos pos, BlockState st
planter.checkForLastTickSync();
if (level.getGameTime() % (80 + (pos.getZ() % 4)) == 0 && planter.isClimateValid())
{
final Fluid fluid = SprinklerBlockEntity.searchForFluid(level, pos, Direction.DOWN);
final Fluid fluid = SprinklerBlockEntity.searchForFluid(level, pos, Direction.DOWN, false);
final boolean valid = fluid != null;
if (valid != planter.hasPipe)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@
import com.eerussianguy.firmalife.common.blocks.greenhouse.PumpingStationBlock;
import com.eerussianguy.firmalife.common.blocks.greenhouse.SprinklerBlock;
import com.eerussianguy.firmalife.common.blocks.greenhouse.SprinklerPipeBlock;
import com.eerussianguy.firmalife.config.FLConfig;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import org.jetbrains.annotations.Nullable;

import net.dries007.tfc.common.TFCTags;
import net.dries007.tfc.common.blockentities.TFCBlockEntity;
import net.dries007.tfc.common.blocks.DirectionPropertyBlock;
import net.dries007.tfc.common.capabilities.Capabilities;
import net.dries007.tfc.common.capabilities.FluidTankCallback;
import net.dries007.tfc.util.Helpers;

Expand All @@ -31,7 +38,7 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, Sprin
{
if (level.getGameTime() % (80 + (pos.getZ() % 4)) == 0 && sprinkler.valid && state.getBlock() instanceof AbstractSprinklerBlock block)
{
final Fluid fluid = searchForFluid(level, pos, block instanceof SprinklerBlock ? Direction.UP : Direction.DOWN);
final Fluid fluid = searchForFluid(level, pos, block instanceof SprinklerBlock ? Direction.UP : Direction.DOWN, true);
final boolean valid = fluid != null;
if (valid)
{
Expand All @@ -56,8 +63,30 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, Sprin
* @return A fluid if found, otherwise {@code null}
*/
@Nullable
public static Fluid searchForFluid(Level level, BlockPos start, Direction pipeDirection)
public static Fluid searchForFluid(Level level, BlockPos start, Direction pipeDirection, boolean drain)
{
if (!FLConfig.SERVER.usePipesForSprinklers.get())
{
final BlockPos checkPos = start.relative(pipeDirection);
final BlockEntity be = level.getBlockEntity(checkPos);
if (be != null)
{
final IFluidHandler cap = Helpers.getCapability(be, Capabilities.FLUID);
if (cap != null)
{
final Fluid fluid = cap.getFluidInTank(0).getFluid();
if (fluid != Fluids.EMPTY && Helpers.isFluid(fluid, TFCTags.Fluids.ANY_FRESH_WATER))
{
if (drain)
{
cap.drain(1, IFluidHandler.FluidAction.EXECUTE);
}
return fluid;
}
}
}
return null;
}
final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
final Queue<Path> queue = new ArrayDeque<>();
final Set<BlockPos> seen = new ObjectOpenHashSet<>(64);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Map;
import com.eerussianguy.firmalife.common.blocks.greenhouse.SprinklerPipeBlock;
import com.eerussianguy.firmalife.config.FLConfig;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.BlockItem;
Expand Down Expand Up @@ -72,6 +73,6 @@ private BlockState getPlacementState(Block block, BlockPlaceContext context)

private boolean isPipe(Level level, BlockPos pos)
{
return level.getBlockState(pos).getBlock() instanceof SprinklerPipeBlock;
return level.getBlockState(pos).getBlock() instanceof SprinklerPipeBlock || !FLConfig.SERVER.usePipesForSprinklers.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class FLServerConfig
public final IntValue greenhouseRadius;
public final IntValue cellarRadius;
public final BooleanValue mechanicalPowerCheatMode;
public final BooleanValue usePipesForSprinklers;


FLServerConfig(Builder innerBuilder)
Expand Down Expand Up @@ -67,6 +68,7 @@ public class FLServerConfig
greenhouseRadius = builder.apply("greenhouseRadius").comment("The max bounded distance from the climate station a greenhouse wall can be. Higher numbers = more lag.").defineInRange("greenhouseRadius", 15, 1, 128);
cellarRadius = builder.apply("cellarRadius").comment("The max bounded distance from the climate station a cellar wall can be. Higher numbers = more lag.").defineInRange("cellarRadius", 15, 1, 128);
mechanicalPowerCheatMode = builder.apply("mechanicalPowerCheatMode").comment("If true, the tumbler and the pumping station work magically with a redstone signal and no power required.").define("mechanicalPowerCheatMode", false);
usePipesForSprinklers = builder.apply("usePipesForSprinklers").comment("If true, sprinkler will not accept firmalife pipes and will instead require something that exposes a fluid capability, eg. a barrel.").define("usePipesForSprinklers", true);

innerBuilder.pop().push("foodTraits");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
],
"item": {
"id": "firmalife:rennet",
"Count": 2
"Count": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
],
"item": {
"id": "firmalife:rennet",
"Count": 3
"Count": 6
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"__comment__": "This file was automatically created by mcresources",
"input": {
"ingredient": {
"tag": "firmalife:pumpkin_knapping"
"type": "tfc:not_rotten",
"ingredient": {
"tag": "firmalife:pumpkin_knapping"
}
},
"count": 1
},
Expand Down

0 comments on commit eae4965

Please sign in to comment.