better linker handling, remove excess imports in BlockKeyboardRight
This commit is contained in:
parent
06597c4506
commit
c9589d9e3c
|
|
@ -5,34 +5,26 @@
|
|||
package net.montoyo.wd.block;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
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.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import net.montoyo.wd.core.DefaultPeripheral;
|
||||
import net.montoyo.wd.core.IPeripheral;
|
||||
import net.montoyo.wd.entity.TileEntityKeyboard;
|
||||
import net.montoyo.wd.init.BlockInit;
|
||||
import net.montoyo.wd.item.ItemLinker;
|
||||
import net.montoyo.wd.net.Messages;
|
||||
import net.montoyo.wd.net.client.CMessageCloseGui;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,26 @@ public class BlockScreen extends BaseEntityBlock {
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState p_60515_, Level p_60516_, BlockPos p_60517_, BlockState p_60518_, boolean p_60519_) {
|
||||
// TODO: make this also get called on client?
|
||||
for (BlockSide value : BlockSide.values()) {
|
||||
Vector3i vec = new Vector3i(p_60517_.getX(), p_60517_.getY(), p_60517_.getZ());
|
||||
Multiblock.findOrigin(p_60516_, vec, value, null);
|
||||
BlockPos bp = new BlockPos(vec.x, vec.y, vec.z);
|
||||
if (!bp.equals(p_60517_)) {
|
||||
p_60516_.removeBlockEntity(bp);
|
||||
p_60516_.setBlock(
|
||||
bp, p_60516_.getBlockState(bp).setValue(hasTE, false),
|
||||
11
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
super.onRemove(p_60515_, p_60516_, p_60517_, p_60518_, p_60519_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos position, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
ItemStack heldItem = player.getItemInHand(hand);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class ItemLinker extends Item implements WDItem {
|
|||
}
|
||||
|
||||
Vector3i pos = new Vector3i(context.getClickedPos());
|
||||
BlockSide side = BlockSide.values()[context.getHorizontalDirection().ordinal()];
|
||||
BlockSide side = BlockSide.values()[context.getClickedFace().ordinal()];
|
||||
Multiblock.findOrigin(context.getLevel(), pos, side, null);
|
||||
|
||||
BlockEntity te = context.getLevel().getBlockEntity(pos.toBlock());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user