Skip to content

Commit

Permalink
Well
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Apr 9, 2024
1 parent 9b94efe commit 1ed2a78
Showing 1 changed file with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package org.violetmoon.quark.content.building.block;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.violetmoon.quark.content.automation.module.PistonsMoveTileEntitiesModule;
import org.violetmoon.quark.content.building.module.RopeModule;
import org.violetmoon.zeta.block.ZetaBlock;
import org.violetmoon.zeta.item.ZetaBlockItem;
import org.violetmoon.zeta.module.ZetaModule;
import org.violetmoon.zeta.registry.IZetaBlockItemProvider;
import org.violetmoon.zeta.registry.RenderLayerRegistry;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
Expand Down Expand Up @@ -40,19 +50,9 @@
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.fluids.FluidActionResult;
import net.minecraftforge.fluids.FluidUtil;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import org.violetmoon.quark.content.automation.module.PistonsMoveTileEntitiesModule;
import org.violetmoon.quark.content.building.module.RopeModule;
import org.violetmoon.zeta.block.ZetaBlock;
import org.violetmoon.zeta.item.ZetaBlockItem;
import org.violetmoon.zeta.module.ZetaModule;
import org.violetmoon.zeta.registry.IZetaBlockItemProvider;
import org.violetmoon.zeta.registry.RenderLayerRegistry;

public class RopeBlock extends ZetaBlock implements IZetaBlockItemProvider, SimpleWaterloggedBlock {

private static final VoxelShape SHAPE = box(6, 0, 6, 10, 16, 10);
Expand Down Expand Up @@ -131,7 +131,14 @@ public InteractionResult use(@NotNull BlockState state, @NotNull Level worldIn,
return InteractionResult.sidedSuccess(worldIn.isClientSide);
}
} else if(stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).isPresent()) { //TODO: Forge extension
return FluidUtil.interactWithFluidHandler(player, hand, worldIn, getBottomPos(worldIn, pos), Direction.UP) ? InteractionResult.sidedSuccess(worldIn.isClientSide) : InteractionResult.PASS;
FluidActionResult interact = FluidUtil.tryPickUpFluid(stack, player, worldIn, getBottomPos(worldIn, pos), Direction.UP);
if(interact.success) {
stack.shrink(1);
if(!player.addItem(interact.result))
player.drop(interact.result, false);
}

return interact.success ? InteractionResult.sidedSuccess(worldIn.isClientSide) : InteractionResult.PASS;
} else if(stack.getItem() == Items.GLASS_BOTTLE) {
BlockPos bottomPos = getBottomPos(worldIn, pos);
BlockState stateAt = worldIn.getBlockState(bottomPos);
Expand All @@ -144,7 +151,7 @@ public InteractionResult use(@NotNull BlockState state, @NotNull Level worldIn,

if(stack.isEmpty())
player.setItemInHand(hand, bottleStack);
else if(!player.getInventory().add(bottleStack))
else if(!player.addItem(bottleStack))
player.drop(bottleStack, false);

return InteractionResult.sidedSuccess(worldIn.isClientSide);
Expand Down

0 comments on commit 1ed2a78

Please sign in to comment.