Allow Drain drain Cauldrons. Thanks to aria1th
There's no proper fluid interface in cauldron block so its only working for Water and Lava. If any mods uses cauldron as other fluid holder, it might have to change, but I've never seen one.
This commit is contained in:
parent
6a91757791
commit
f75ebc2361
1 changed files with 22 additions and 3 deletions
|
@ -24,11 +24,10 @@
|
|||
|
||||
package techreborn.blockentity.machine.misc;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidDrainable;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -91,6 +90,26 @@ public class DrainBlockEntity extends MachineBaseBlockEntity implements IToolDro
|
|||
TechReborn.LOGGER.debug("Could not get Fluid from ItemStack " + fluidContainer.getItem());
|
||||
}
|
||||
}
|
||||
if (aboveBlock instanceof LeveledCauldronBlock && aboveBlockState.isOf(Blocks.WATER_CAULDRON)) { //ensure Water cauldron
|
||||
Fluid drainFluid = Fluids.WATER;
|
||||
int level;
|
||||
if (aboveBlockState.contains(LeveledCauldronBlock.LEVEL)){
|
||||
level = aboveBlockState.get(LeveledCauldronBlock.LEVEL);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
world.setBlockState(above, Blocks.CAULDRON.getDefaultState());
|
||||
internalTank.setFluidInstance(
|
||||
new FluidInstance(drainFluid, FluidValue.BUCKET.fraction(3).multiply(level))
|
||||
);
|
||||
}
|
||||
if (aboveBlock instanceof LavaCauldronBlock){
|
||||
world.setBlockState(above, Blocks.CAULDRON.getDefaultState());
|
||||
internalTank.setFluidInstance(
|
||||
new FluidInstance(Fluids.LAVA, FluidValue.BUCKET)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue