trying use to see if it works instead of onBlockActivated

This commit is contained in:
dragonruler1000 2025-05-16 08:47:54 -05:00
parent 748ab1b988
commit d962b7d8b7

View file

@ -5,7 +5,6 @@ package us.minecraftchest2.hdm_mod.block.custom;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.HorizontalBlock; import net.minecraft.block.HorizontalBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -41,7 +40,7 @@ public class Window extends HorizontalBlock {
} }
// VoxelShapes define the physical shape of the block for each direction (NORTH, EAST, SOUTH, WEST) // VoxelShapes define the physical shape of the block for each direction (NORTH, EAST, SOUTH, WEST)
// These shapes are made up of multiple cubic sections combined together // These shapes are made up of multiple cubic sections combined
private static final VoxelShape SHAPE_N = Stream.of( private static final VoxelShape SHAPE_N = Stream.of(
Block.makeCuboidShape(5, 11, 5, 6, 13, 11), // Window frame pieces Block.makeCuboidShape(5, 11, 5, 6, 13, 11), // Window frame pieces
Block.makeCuboidShape(4, 0, 4, 12, 1, 12), // Base Block.makeCuboidShape(4, 0, 4, 12, 1, 12), // Base
@ -102,6 +101,10 @@ public class Window extends HorizontalBlock {
@Override @Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos,
PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
String message = "blockActivated";
ITextComponent msg = new StringTextComponent(message);
player.sendMessage(msg, player.getUniqueID());
// Client-side: Only show a status message // Client-side: Only show a status message
if (worldIn.isRemote()) { if (worldIn.isRemote()) {
player.sendStatusMessage(new StringTextComponent("Client: Block activated!"), true); player.sendStatusMessage(new StringTextComponent("Client: Block activated!"), true);