Skip to content

Commit

Permalink
fluid hoppers inserting into cauldrons
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Nov 9, 2024
1 parent c7e781a commit 02ea434
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ public void tick() {
//then pull from hopper facey side
Direction exportToSide = this.getBlockState().get(BlockFluidHopper.FACING);
if (exportToSide != null && exportToSide != Direction.UP) {
//if the target is a tank
moveFluids(exportToSide, pos.offset(exportToSide), FLOW, tank);
//if the target is a cauldron
UtilFluid.insertSourceCauldron(world, pos.offset(exportToSide), tank);
this.updateComparatorOutputLevel();
this.updateComparatorOutputLevelAt(pos.offset(exportToSide));
}
Expand All @@ -83,7 +86,6 @@ private void tryExtract(Direction extractSide) {
if (success) {
this.updateComparatorOutputLevelAt(target);
this.updateComparatorOutputLevel();
return;
}
}
if (!success && tank.getSpace() >= FluidAttributes.BUCKET_VOLUME) {
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/lothrazar/cyclic/util/UtilFluid.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,32 @@ public static Model3D getFluidModel(FluidStack fluid, int stage) {
return model;
}

/**
*
* @param level
* @param posTarget
* where the cauldron exists
* @param tank
* of myself that i want to extract frm for the target
* @return
*/
public static boolean insertSourceCauldron(World level, BlockPos posTarget, IFluidHandler tank) {
//for mc 1.16.5 cauldrons only allow water. lava/snow cauldronds added in 1.17
BlockState targetState = level.getBlockState(posTarget);
if (targetState.getBlock() == Blocks.CAULDRON.getBlock() && targetState.hasProperty(CauldronBlock.LEVEL) && targetState.get(CauldronBlock.LEVEL) == 0) {
FluidStack simulate = tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.SIMULATE);
if (simulate.getAmount() == FluidAttributes.BUCKET_VOLUME) {
//we are able to fill the tank
if (level.setBlockState(posTarget, targetState.with(CauldronBlock.LEVEL, 3))) {
//we filled the cauldron, so now drain with execute
tank.drain(new FluidStack(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), FluidAttributes.BUCKET_VOLUME), FluidAction.EXECUTE);
return true;
}
}
}
return false;
}

public static void extractSourceWaterloggedCauldron(World level, BlockPos posTarget, IFluidHandler tank) {
if (tank == null) {
return;
Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
,"1.5.22":"Fix #2351 advanced crafting stick not opening. "
,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms "
,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. "
,"1.6.0":" Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Add mouse-dragging capability to the slider controls in machines. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) "
,"1.6.0":"Add mouse-dragging capability to the slider controls in machines. Fluid Hoppers can now insert into cauldrons. Backport #2399 Dry Peat Bog can now hydrate from waterlogged blocks such as scaffolding. Fix spelling #2435. Added an optional item slot in the Block Breaker using the BlockState Data Card so players have the option to limit the block breaker to only the targets listed in the data card. Add new block data tags cyclic:ignored/breaker and cyclic:ignored/miner so that pack devs can customize these machines to not break certain blocks (regardless of hardness). Many blocks now allow minecraft:comparator to pull a redstone signal based on inventory contents (most machines and blocks that have inventory). Fluid collector will now place air and scoop up the fluid if the itemslot is empty. New feature: some machines can now be placed facing Up or Down vertically for convenience (harvester, forester, miner, item collector, fluid collector, dropper). Backported machine feature 'Preview Outline' mode on machines that already have the button. Backported cable (fluid & energy) buffer and flow speed configs from 1.20.1. Facades overhaul backported from 1.20.1: Renamed 'Concentrated Glowstone' to 'Glowstone Facade' and 'Concentrated Soundproofing' to 'Soundproofing Facade' . Backport cable facades from 1.20.1 (New feature with cables: hide them using solid blocks with a feature called 'facades', just sneak-left-click a block onto the cable; empty hand to remove it) "
}
}

0 comments on commit 02ea434

Please sign in to comment.