Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ protected boolean tryRemoveFluid(IFluidHandler source, int amount, boolean doTra
*/
protected boolean tryPlaceSigilFluid(Player player, Level world, BlockPos blockPos)
{
if (!world.isEmptyBlock(blockPos) && !world.getBlockState(blockPos).canBeReplaced()) return false;

FluidStack resource = sigilFluid;
BlockState state = sigilFluid.getFluid().getFluidType().getBlockForFluidState(world, blockPos, sigilFluid.getFluid().defaultFluidState());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import wayoftime.bloodmagic.util.helper.PlayerHelper;
import wayoftime.bloodmagic.ConfigManager;

import wayoftime.bloodmagic.common.item.sigil.ISigil.Holding;

public class ItemSigilLava extends ItemSigilFluidBase implements IAlchemyItem
{
public ItemSigilLava()
Expand Down Expand Up @@ -82,8 +80,7 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, Intera
// Place fluid in world
if (destination == null && destinationSide == null)
{
BlockPos targetPos = blockPos.relative(sideHit);
if (tryPlaceSigilFluid(player, world, targetPos) && NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
if (tryPlaceSigilFluid(player, world, blockpos1) && NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
{
return InteractionResultHolder.success(stack);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
Expand Down Expand Up @@ -82,13 +84,18 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, Intera
// world.setBlockAndUpdate(blockPos, Blocks.CAULDRON.defaultBlockState().setValue(CauldronBlock., 3));
// return InteractionResultHolder.success(stack);
// }
//waterlog block if possible
if (tryWaterlogBlock(world, player, stack, blockPos)
|| tryWaterlogBlock(world, player, stack, blockpos1))
{
return InteractionResultHolder.success(stack);
}

// Case for if block at blockPos is not a tank
// Place fluid in world
if (destination == null && destinationSide == null)
{
BlockPos targetPos = blockPos.relative(sideHit);
if (tryPlaceSigilFluid(player, world, targetPos) && NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
if (tryPlaceSigilFluid(player, world, blockpos1) && NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
{
return InteractionResultHolder.success(stack);
}
Expand All @@ -99,6 +106,17 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, Intera
return super.use(world, player, hand);
}

private boolean tryWaterlogBlock(Level world, Player player, ItemStack stack, BlockPos blockPos) {
if (world.getBlockState(blockPos).getBlock() instanceof SimpleWaterloggedBlock
&& world.setBlock(blockPos, world.getBlockState(blockPos).setValue(BlockStateProperties.WATERLOGGED, true), 3)
&& NetworkHelper.getSoulNetwork(getBinding(stack)).syphonAndDamage(player, SoulTicket.item(stack, world, player, getLpUsed())).isSuccess())
{
world.scheduleTick(blockPos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
return true;
}
return false;
}

@Override
public ItemStack onConsumeInput(ItemStack stack)
{
Expand Down