diff --git a/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java index 92c0f87..aa3ea06 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/DrawerControllerBlock.java @@ -1,14 +1,22 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; +import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; import com.buuz135.functionalstorage.block.tile.DrawerControllerTile; import com.hrznstudio.titanium.block.RotatableBlock; +import com.hrznstudio.titanium.util.TileUtil; +import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.NotNull; public class DrawerControllerBlock extends RotatableBlock { @@ -35,4 +43,9 @@ public class DrawerControllerBlock extends RotatableBlock super.createBlockStateDefinition(p_206840_1_); p_206840_1_.add(DrawerBlock.LOCKED); } + + @Override + public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { + return TileUtil.getTileEntity(worldIn, pos, DrawerControllerTile.class).map(drawerTile -> drawerTile.onSlotActivated(player, hand, ray.getDirection(), ray.getLocation().x, ray.getLocation().y, ray.getLocation().z)).orElse(InteractionResult.PASS); + } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java index d03a27e..a3722bf 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/DrawerControllerTile.java @@ -7,11 +7,17 @@ import com.buuz135.functionalstorage.inventory.BigInventoryHandler; import com.buuz135.functionalstorage.inventory.ControllerInventoryHandler; import com.buuz135.functionalstorage.item.ConfigurationToolItem; import com.buuz135.functionalstorage.item.LinkingToolItem; +import com.buuz135.functionalstorage.item.UpgradeItem; import com.hrznstudio.titanium.annotation.Save; import com.hrznstudio.titanium.block.BasicTileBlock; +import com.hrznstudio.titanium.component.inventory.InventoryComponent; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; @@ -26,11 +32,13 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.UUID; public class DrawerControllerTile extends ControllableDrawerTile{ - //TODO Allow insertion of items + private static HashMap INTERACTION_LOGGER = new HashMap<>(); @Save private ConnectedDrawers connectedDrawers; @@ -65,6 +73,31 @@ public class DrawerControllerTile extends ControllableDrawerTile