Code: Select all
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) // Client-side: Only show a status message
if (worldIn.isRemote()) {
player.sendStatusMessage(new StringTextComponent("Client: Block activated!"), true);
return ActionResultType.SUCCESS;
}
// Server-side logic below
player.sendMessage(new StringTextComponent("blockActivated"), player.getUniqueID());
}